1
0
Fork 0
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:
Kazuhiro NISHIYAMA 2020-01-03 00:02:28 +09:00
parent 749915e940
commit bba4916122
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

2
ast.rb
View file

@ -84,7 +84,7 @@ class RubyVM
# root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# root.type # => :SCOPE
# call = root.children[2]
# call.type # => :OPCALL
# call.type # => :LASGN
def type
__builtin_ast_node_type
end