diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | compile.c | 9 |
2 files changed, 8 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Mon Jun 9 22:46:47 2008 wanabe <s.wanabe@gmail.com> + + * compile.c : treat []&&= in virtually the same way as []||=. + [ruby-dev:34679] + Mon Jun 9 21:17:26 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * enc/depend (clean): remove build directories. @@ -3513,7 +3513,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } else { /* and */ + ADD_INSN(ret, nd_line(node), dup); ADD_INSNL(ret, nd_line(node), branchunless, label); + ADD_INSN(ret, nd_line(node), pop); } COMPILE(ret, "NODE_OP_ASGN1 args->head: ", node->nd_args->nd_head); @@ -3529,17 +3531,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } ADD_INSNL(ret, nd_line(node), jump, lfin); ADD_LABEL(ret, label); - if (id == 0) { /* or */ + if (id == 0 || id == 1) { /* 0: or, 1: and */ ADD_INSN(ret, nd_line(node), swap); ADD_INSN(ret, nd_line(node), pop); ADD_INSN(ret, nd_line(node), swap); ADD_INSN(ret, nd_line(node), pop); } - else if (id == 1) { /* and */ - ADD_INSN(ret, nd_line(node), pop); - ADD_INSN(ret, nd_line(node), pop); - ADD_INSN(ret, nd_line(node), putnil); - } ADD_LABEL(ret, lfin); } else { |