Commit cc2786c8 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

resolve conflict; ref #3285

parents 0d48a978 12539825
...@@ -2030,6 +2030,7 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -2030,6 +2030,7 @@ codegen(codegen_scope *s, node *tree, int val)
} }
genop(s, MKOP_sBx(OP_JMP, s->loop->pc2 - s->pc)); genop(s, MKOP_sBx(OP_JMP, s->loop->pc2 - s->pc));
} }
if (val) push();
break; break;
case NODE_RETRY: case NODE_RETRY:
...@@ -2064,6 +2065,7 @@ codegen(codegen_scope *s, node *tree, int val) ...@@ -2064,6 +2065,7 @@ codegen(codegen_scope *s, node *tree, int val)
genop(s, MKOP_sBx(OP_JMP, lp->pc1 - s->pc)); genop(s, MKOP_sBx(OP_JMP, lp->pc1 - s->pc));
} }
} }
if (val) push();
} }
break; break;
......
...@@ -13,3 +13,21 @@ end ...@@ -13,3 +13,21 @@ end
assert('empty condition in ternary expression parses correctly') do assert('empty condition in ternary expression parses correctly') do
assert_equal(() ? 1 : 2, 2) assert_equal(() ? 1 : 2, 2)
end end
assert('codegen absorbs arguments to redo and retry if they are the argument of a call') do
assert_nothing_raised do
a=*"1", case nil
when 1
redo |
1
end
end
assert_nothing_raised do
a=*"1", case nil
when 1
retry |
1
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment