From 4b6f3bce2502e6bbe0a600aef61c8c129fa2af3e Mon Sep 17 00:00:00 2001 From: mame Date: Tue, 16 Jan 2018 07:24:53 +0000 Subject: node.c: Stop double meaning of NODE_FOR by introducing NODE_FOR_MASGN NODE_FOR was used both for "for"-statement itself and for multi-assignment of for-statement (for x, y, in...end). This change separates the two purposes, NODE_FOR for the former, and newly introduced NODE_FOR_MASGN for the latter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/-test-/ast/ast.c | 4 ++-- ext/objspace/objspace.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/-test-/ast/ast.c b/ext/-test-/ast/ast.c index ead7400786..eab1cfb99a 100644 --- a/ext/-test-/ast/ast.c +++ b/ext/-test-/ast/ast.c @@ -198,10 +198,10 @@ node_children(rb_ast_t *ast, NODE *node) loop: return rb_ary_new_from_node_args(ast, 2, node->nd_cond, node->nd_body); case NODE_ITER: - goto iter; case NODE_FOR: - iter: return rb_ary_new_from_node_args(ast, 2, node->nd_iter, node->nd_body); + case NODE_FOR_MASGN: + return rb_ary_new_from_node_args(ast, 1, node->nd_var); case NODE_BREAK: goto jump; case NODE_NEXT: diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index e410941c7d..c791f3a7f7 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -382,6 +382,7 @@ count_nodes(int argc, VALUE *argv, VALUE os) COUNT_NODE(NODE_UNTIL); COUNT_NODE(NODE_ITER); COUNT_NODE(NODE_FOR); + COUNT_NODE(NODE_FOR_MASGN); COUNT_NODE(NODE_BREAK); COUNT_NODE(NODE_NEXT); COUNT_NODE(NODE_REDO); -- cgit v1.2.3