From 276fb7e77b20b33f099a11c89e94388ffe3ae40d Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 2 Jun 2010 03:05:06 +0000 Subject: * compile.c (iseq_compile_each): should consider block on stack, if block argument is passed. [ruby-core:30534] * parse.c (arg_concat_gen): should append to nd_head, not to nd_iter for NODE_BLOCK_PASS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index de675a2998..ebe9fef233 100644 --- a/parse.y +++ b/parse.y @@ -1953,7 +1953,12 @@ arg : lhs '=' arg value_expr($6); if (!$3) $3 = NEW_ZARRAY(); - args = arg_concat($3, $6); + if (nd_type($3) == NODE_BLOCK_PASS) { + args = NEW_ARGSCAT($3, $6); + } + else { + args = arg_concat($3, $6); + } if ($5 == tOROP) { $5 = 0; } @@ -8309,7 +8314,10 @@ arg_concat_gen(struct parser_params *parser, NODE *node1, NODE *node2) if (!node2) return node1; switch (nd_type(node1)) { case NODE_BLOCK_PASS: - node1->nd_iter = arg_concat(node1->nd_iter, node2); + if (node1->nd_head) + node1->nd_head = arg_concat(node1->nd_head, node2); + else + node1->nd_head = NEW_LIST(node2); return node1; case NODE_ARGSPUSH: if (nd_type(node2) != NODE_ARRAY) break; -- cgit v1.2.3