From 62b6a462d733a5c0cf2ea947e2f13efce15fd06b Mon Sep 17 00:00:00 2001 From: wanabe Date: Mon, 9 Jun 2008 13:49:16 +0000 Subject: * compile.c : treat []&&= in virtually the same way as []||=. [ruby-dev:34679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 0424a83884..ec54bbf1d5 100644 --- a/compile.c +++ b/compile.c @@ -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 { -- cgit v1.2.3