summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/eval.c b/eval.c
index 7a858018c0f..6e9ad5e9fb9 100644
--- a/eval.c
+++ b/eval.c
@@ -1771,7 +1771,7 @@ rb_eval(self, node)
/* nodes for speed-up(literal match) */
case NODE_MATCH2:
result = rb_reg_match(rb_eval(self,node->nd_recv),
- rb_eval(self,node->nd_value));
+ rb_eval(self,node->nd_value));
break;
/* nodes for speed-up(literal match) */
@@ -1841,7 +1841,12 @@ rb_eval(self, node)
{
VALUE val;
- val = rb_eval(self, node->nd_head);
+ if (node->nd_head) {
+ val = rb_eval(self, node->nd_head);
+ }
+ else {
+ val = Qtrue;
+ }
node = node->nd_body;
while (node) {
NODE *tag;
@@ -2334,17 +2339,15 @@ rb_eval(self, node)
case NODE_OP_ASGN_AND:
result = rb_eval(self, node->nd_head);
- if (RTEST(result)) {
- result = rb_eval(self, node->nd_value);
- }
- break;
+ if (!RTEST(result)) break;
+ node = node->nd_value;
+ goto again;
case NODE_OP_ASGN_OR:
result = rb_eval(self, node->nd_head);
- if (!RTEST(result)) {
- result = rb_eval(self, node->nd_value);
- }
- break;
+ if (RTEST(result)) break;
+ node = node->nd_value;
+ goto again;
case NODE_MASGN:
result = massign(self, node, rb_eval(self, node->nd_value),0);