summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-04-04 23:07:45 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-04-04 23:07:45 +0000
commit6638b504b1ea1d092a75d02aa20674e540dd4b53 (patch)
treeeb4ccda1f0224407af24d5d77c46244ce48ec9a2
parent942129cdba1c2f36b7c4f0539df9b1d3e56339e4 (diff)
merge revision(s) 8e189df32cacef4b21e357a590d349330532baf5: [Backport #17013]
Add operator info to OP_ASGN2 of RubyVM::AbstractSyntaxTree. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ast.c3
-rw-r--r--test/ruby/test_ast.rb11
-rw-r--r--version.h2
3 files changed, 14 insertions, 2 deletions
diff --git a/ast.c b/ast.c
index f0e8dd2eaf..883a838b78 100644
--- a/ast.c
+++ b/ast.c
@@ -443,9 +443,10 @@ node_children(rb_ast_t *ast, NODE *node)
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 1a897ef502..3ba67e69a2 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -269,4 +269,15 @@ class TestAst < Test::Unit::TestCase
assert_equal(:LIT, body.type)
assert_equal([1], body.children)
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 92ef088eb0..c4d0636924 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.6.7"
#define RUBY_RELEASE_DATE "2021-04-05"
-#define RUBY_PATCHLEVEL 180
+#define RUBY_PATCHLEVEL 181
#define RUBY_RELEASE_YEAR 2021
#define RUBY_RELEASE_MONTH 4