[前][次][番号順一覧][スレッド一覧]

ruby-changes:59602

From: Kazuhiro <ko1@a...>
Date: Fri, 3 Jan 2020 00:03:37 +0900 (JST)
Subject: [ruby-changes:59602] bba4916122 (master): Fix example of node.type [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=bba4916122

From bba491612283e5e2b3a05f578350f84ce02274bc Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Fri, 3 Jan 2020 00:02:28 +0900
Subject: 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]
```

diff --git a/ast.rb b/ast.rb
index 1fedf76..d7e9df8 100644
--- a/ast.rb
+++ b/ast.rb
@@ -84,7 +84,7 @@ class RubyVM https://github.com/ruby/ruby/blob/trunk/ast.rb#L84
       #    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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]