mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
089a26b0a6
commit
ed8e265d4b
2 changed files with 12 additions and 6 deletions
11
ast.rb
11
ast.rb
|
@ -140,6 +140,17 @@ module RubyVM::AbstractSyntaxTree
|
|||
Primitive.ast_node_inspect
|
||||
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
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue