summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-25 05:21:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-25 05:21:07 +0000
commit27dfc398a8cd3b63ccc527c914dee5edd696790e (patch)
treeae95b95d1f0af5bc477ce6c340f39b4f9ab39afc /compile.c
parent7b8dc95b3a450b8f20049061054df0d1fc637239 (diff)
compile.c: assignment result of aset_with
* compile.c (iseq_compile_each): result of assignment should be its rhs instead of returned value from a method. [ruby-core:60071] [Bug #9448] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index bd34fa8..6c693da 100644
--- a/compile.c
+++ b/compile.c
@@ -5332,11 +5332,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
iseq_add_mark_object(iseq, str);
COMPILE(ret, "recv", node->nd_recv);
COMPILE(ret, "value", node->nd_args->nd_next->nd_head);
+ if (!poped) {
+ ADD_INSN(ret, line, swap);
+ ADD_INSN1(ret, line, topn, INT2FIX(1));
+ }
ADD_INSN2(ret, line, opt_aset_with,
new_callinfo(iseq, idASET, 2, 0, 0), str);
- if (poped) {
- ADD_INSN(ret, line, pop);
- }
+ ADD_INSN(ret, line, pop);
break;
}