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

ruby-changes:62537

From: nagachika <ko1@a...>
Date: Fri, 7 Aug 2020 20:17:12 +0900 (JST)
Subject: [ruby-changes:62537] e9e4f8430a (ruby_2_7): merge revision(s) 8e189df32cacef4b21e357a590d349330532baf5: [Backport #17013]

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

From e9e4f8430a62f56a4e62dd728f4498ee4c300c12 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Fri, 7 Aug 2020 20:16:51 +0900
Subject: merge revision(s) 8e189df32cacef4b21e357a590d349330532baf5: [Backport
 #17013]

	Add operator info to `OP_ASGN2` of `RubyVM::AbstractSyntaxTree`.

diff --git a/ast.c b/ast.c
index 1133fb8..79d8b12 100644
--- a/ast.c
+++ b/ast.c
@@ -407,9 +407,10 @@ node_children(rb_ast_t *ast, NODE *node) https://github.com/ruby/ruby/blob/trunk/ast.c#L407
                                     NEW_CHILD(ast, node->nd_args->nd_head),
                                     NEW_CHILD(ast, node->nd_args->nd_body));
       case NODE_OP_ASGN2:
-        return rb_ary_new_from_args(4, NEW_CHILD(ast, node->nd_recv),
+        return rb_ary_new_from_args(5, NEW_CHILD(ast, node->nd_recv),
                                     node->nd_next->nd_aid ? Qtrue : Qfalse,
                                     ID2SYM(node->nd_next->nd_vid),
+                                    ID2SYM(node->nd_next->nd_mid),
                                     NEW_CHILD(ast, node->nd_value));
       case NODE_OP_ASGN_AND:
         return rb_ary_new_from_args(3, NEW_CHILD(ast, node->nd_head), ID2SYM(idANDOP),
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 147d05e..da7dde4 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -319,4 +319,15 @@ class TestAst < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_ast.rb#L319
     helper.validate_range
     assert_equal([], helper.errors)
   end
+
+  def test_op_asgn2
+    node = RubyVM::AbstractSyntaxTree.parse("struct.field += foo")
+    _, _, body = *node.children
+    assert_equal(:OP_ASGN2, body.type)
+    recv, _, mid, op, value = body.children
+    assert_equal(:VCALL, recv.type)
+    assert_equal(:field, mid)
+    assert_equal(:+, op)
+    assert_equal(:VCALL, value.type)
+  end
 end
diff --git a/version.h b/version.h
index 8c5893a..ab534ee 100644
--- a/version.h
+++ b/version.h
@@ -2,11 +2,11 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L2
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 1
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 117
+#define RUBY_PATCHLEVEL 118
 
 #define RUBY_RELEASE_YEAR 2020
 #define RUBY_RELEASE_MONTH 8
-#define RUBY_RELEASE_DAY 1
+#define RUBY_RELEASE_DAY 7
 
 #include "ruby/version.h"
 
-- 
cgit v0.10.2


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

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