diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-06 01:51:45 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-06 01:51:45 +0000 |
commit | 9a524fad38693240a0ac9c8dbfcb956516475861 (patch) | |
tree | 3463852b6597ecc156a2b944834ad4f4074aa03e /compile.c | |
parent | b244c0dd3a6268c49ebebde8d935fb3d191aee33 (diff) | |
download | ruby-9a524fad38693240a0ac9c8dbfcb956516475861.tar.gz |
* compile.c (iseq_compile_each): fix around yield arguments
(with NODE_ARGSCAT).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -3762,11 +3762,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (node->nd_head) { if (nd_type(node->nd_head) == NODE_ARRAY) { NODE *p; - for (argc = 0, p = node->nd_head; p; - p = p->nd_next, argc++) { - /* count argc */ - } + argc = node->nd_head->nd_alen; compile_array(iseq, args, node->nd_head, Qfalse); POP_ELEMENT(args); debugs("argc: %d\n", argc); @@ -3777,10 +3774,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) flag |= VM_CALL_ARGS_SPLAT_BIT; } - compile_array(iseq, args, node->nd_head->nd_head, - Qfalse); + argc = node->nd_head->nd_head->nd_alen + 1; + compile_array(iseq, args, node->nd_head->nd_head, Qfalse); POP_ELEMENT(args); - argc = LIST_SIZE(args) + 1; COMPILE(args, "args(cat: splat)", node->nd_head->nd_body); |