summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-05 11:30:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-05 11:30:50 +0000
commit600601c338006d9701ce3a8ee9922cdc47d9fed8 (patch)
treef64f740e5598f72a0fff9b604a95bea8d08f29a3 /compile.c
parent3a32ef53aaab15199e59c643630726b041c9fa88 (diff)
* compile.c (iseq_compile_each): to_a method should be called.
[Bug #3658] * compile.c (iseq_compile_each): ditto for ARGSPUSH. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index f838654cf4..3ff91f5b51 100644
--- a/compile.c
+++ b/compile.c
@@ -4522,14 +4522,23 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_ARGSCAT:{
COMPILE_(ret, "argscat head", node->nd_head, poped);
- COMPILE_(ret, "argscat body", node->nd_body, poped);
- if (poped) break;
+ COMPILE(ret, "argscat body", node->nd_body);
+ if (poped) {
+ ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
+ ADD_INSN(ret, nd_line(node), pop);
+ break;
+ }
ADD_INSN(ret, nd_line(node), concatarray);
break;
}
case NODE_ARGSPUSH:{
- COMPILE(ret, "arsgpush head", node->nd_head);
+ COMPILE_(ret, "arsgpush head", node->nd_head, poped);
COMPILE(ret, "argspush body", node->nd_body);
+ if (poped) {
+ ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
+ ADD_INSN(ret, nd_line(node), pop);
+ break;
+ }
ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
ADD_INSN(ret, nd_line(node), concatarray);
break;