summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-09 04:40:07 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-09 04:40:07 +0000
commit2ed7d6d7279d413d7af62d9b20cc17fb2b1e7650 (patch)
tree2fd130cf4156be79e934433c8a2c62643efa284b /compile.c
parent299d236d3b6b471ba01b1c56359c13e83b72f159 (diff)
merges r28877 from trunk into ruby_1_9_2.
-- * compile.c (NODE_ARGSCAT, NODE_ARGSPUSH): drop unused ARGSCAT results when poped is true. [ruby-dev:41933], [Bug #3658] This is retry of r28870 and r28873 which were reverted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/compile.c b/compile.c
index 4621cd978b..93a6c34b71 100644
--- a/compile.c
+++ b/compile.c
@@ -4525,16 +4525,34 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_ARGSCAT:{
- COMPILE(ret, "argscat head", node->nd_head);
- COMPILE(ret, "argscat body", node->nd_body);
- ADD_INSN(ret, nd_line(node), concatarray);
+ if (poped) {
+ COMPILE(ret, "argscat head", node->nd_head);
+ ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
+ ADD_INSN(ret, nd_line(node), pop);
+ COMPILE(ret, "argscat body", node->nd_body);
+ ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
+ ADD_INSN(ret, nd_line(node), pop);
+ }
+ else {
+ COMPILE(ret, "argscat head", node->nd_head);
+ COMPILE(ret, "argscat body", node->nd_body);
+ ADD_INSN(ret, nd_line(node), concatarray);
+ }
break;
}
case NODE_ARGSPUSH:{
- COMPILE(ret, "arsgpush head", node->nd_head);
- COMPILE(ret, "argspush body", node->nd_body);
- ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
- ADD_INSN(ret, nd_line(node), concatarray);
+ if (poped) {
+ COMPILE(ret, "arsgpush head", node->nd_head);
+ ADD_INSN1(ret, nd_line(node), splatarray, Qfalse);
+ ADD_INSN(ret, nd_line(node), pop);
+ COMPILE_(ret, "argspush body", node->nd_body, poped);
+ }
+ else {
+ COMPILE(ret, "arsgpush head", node->nd_head);
+ COMPILE_(ret, "argspush body", node->nd_body, poped);
+ ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1));
+ ADD_INSN(ret, nd_line(node), concatarray);
+ }
break;
}
case NODE_SPLAT:{