summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 13:49:16 +0000
committerwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 13:49:16 +0000
commit62b6a462d733a5c0cf2ea947e2f13efce15fd06b (patch)
tree41c7b212d1b4616f5abe9eb9b94001faab1049a6 /compile.c
parentfc0babb4c2ce8eaff3549f4502fb32d056482b31 (diff)
* 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
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c9
1 files changed, 3 insertions, 6 deletions
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 {