mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix example of node.type [ci skip]
``` % docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=ruby-2.6 ./all-ruby -e 'root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2") p [root, root.type] call = root.children[2] p [call, call.type] ' ruby-2.6.0 [#<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:9>, :SCOPE] [#<RubyVM::AbstractSyntaxTree::Node:LASGN@1:0-1:9>, :LASGN] ... ruby-2.7.0 [#<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:9>, :SCOPE] [#<RubyVM::AbstractSyntaxTree::Node:LASGN@1:0-1:9>, :LASGN] ```
This commit is contained in:
parent
749915e940
commit
bba4916122
1 changed files with 1 additions and 1 deletions
2
ast.rb
2
ast.rb
|
@ -84,7 +84,7 @@ class RubyVM
|
||||||
# root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
|
# root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
|
||||||
# root.type # => :SCOPE
|
# root.type # => :SCOPE
|
||||||
# call = root.children[2]
|
# call = root.children[2]
|
||||||
# call.type # => :OPCALL
|
# call.type # => :LASGN
|
||||||
def type
|
def type
|
||||||
__builtin_ast_node_type
|
__builtin_ast_node_type
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue