summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 15:04:05 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 15:04:05 +0000
commitfad01941b3239faa4756c9f2db00fca00a786063 (patch)
tree3e97f71722cc6521783bdead2a9fe3e292df8fb4
parent100bf2757468439106775a7d95a791a8c10b874a (diff)
parse.y (arg_append): support NODE_ARGSCAT case
Because of the lack of this case, `[*ary,1,2,3,4,5,6]` was parsed into an inefficient AST like `ary + [1,2] + [3,4] + [5,6]`. A patch from Anmol Chopra <anmolchopra@rocketbox.in>. Fixes [Bug #15018]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--parse.y5
1 files changed, 5 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 9971ba0..fb47180 100644
--- a/parse.y
+++ b/parse.y
@@ -9301,6 +9301,11 @@ arg_append(struct parser_params *p, NODE *node1, NODE *node2, const YYLTYPE *loc
node1->nd_loc.end_pos = node1->nd_body->nd_loc.end_pos;
nd_set_type(node1, NODE_ARGSCAT);
return node1;
+ case NODE_ARGSCAT:
+ if (nd_type(node1->nd_body) != NODE_ARRAY) break;
+ node1->nd_body = list_append(p, node1->nd_body, node2);
+ node1->nd_loc.end_pos = node1->nd_body->nd_loc.end_pos;
+ return node1;
}
return NEW_ARGSPUSH(node1, node2, loc);
}