ruby-changes:52303
From: mame <ko1@a...>
Date: Thu, 23 Aug 2018 00:04:13 +0900 (JST)
Subject: [ruby-changes:52303] mame:r64510 (trunk): parse.y (arg_append): support NODE_ARGSCAT case
mame 2018-08-23 00:04:05 +0900 (Thu, 23 Aug 2018) New Revision: 64510 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64510 Log: 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@r...>. Fixes [Bug #15018]. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 64509) +++ parse.y (revision 64510) @@ -9301,6 +9301,11 @@ arg_append(struct parser_params *p, NODE https://github.com/ruby/ruby/blob/trunk/parse.y#L9301 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/