diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2021-06-21 21:15:25 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2021-06-21 21:15:25 +0900 |
commit | ed8e265d4be53e15bffea3b1db649b1cea4ea864 (patch) | |
tree | cd3faaa65dd3ebf0fd5b3f9dae16666fa9f17196 /ast.rb | |
parent | 089a26b0a619a649b1958061df8f21a6cdc6cacd (diff) |
Experimentally expose RubyVM::AST::Node#node_id
Now ISeq#to_a includes the node_id list for each bytecode instruction.
I want a way to retrieve the AST::Node instance corresponding to an
instruction for a research purpose including TypeProf-based LSP server.
Diffstat (limited to 'ast.rb')
-rw-r--r-- | ast.rb | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -141,6 +141,17 @@ module RubyVM::AbstractSyntaxTree end # call-seq: + # node.node_id -> integer + # + # Returns an internal node_id number. + # Note that this is an API for ruby internal use, debugging, + # and research. Do not use this for any other purpose. + # The compatibility is not guaranteed. + def node_id + Primitive.ast_node_node_id + end + + # call-seq: # node.script_lines -> array # # Returns the original source code as an array of lines. |