mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
100bf27574
commit
fad01941b3
1 changed files with 5 additions and 0 deletions
5
parse.y
5
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue