diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-17 10:18:39 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-17 10:18:39 +0000 |
commit | 021f166509dfead5f1de67651af60de43242365c (patch) | |
tree | b5a3c4638cb093e0d910f621e2cd15373caef874 /compile.c | |
parent | becd789625323ef37c16829b8f87153f832a7fa4 (diff) |
* compile.c (iseq_compile_each): fix return value of obj[a,*b]=c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -4968,9 +4968,20 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (flag & VM_CALL_ARGS_BLOCKARG_BIT) { ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); + if (flag & VM_CALL_ARGS_SPLAT_BIT) { + ADD_INSN1(ret, nd_line(node), putobject, INT2FIX(-1)); + ADD_SEND(ret, nd_line(node), ID2SYM(idAREF), INT2FIX(1)); + } ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 3)); ADD_INSN (ret, nd_line(node), pop); } + else if (flag & VM_CALL_ARGS_SPLAT_BIT) { + ADD_INSN(ret, nd_line(node), dup); + ADD_INSN1(ret, nd_line(node), putobject, INT2FIX(-1)); + ADD_SEND(ret, nd_line(node), ID2SYM(idAREF), INT2FIX(1)); + ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2)); + ADD_INSN (ret, nd_line(node), pop); + } else { ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 1)); } |