resolve conflict; ref #3285

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-11-25 09:25:51 +09:00
2 changed files with 20 additions and 0 deletions
+2
View File
@@ -2030,6 +2030,7 @@ codegen(codegen_scope *s, node *tree, int val)
}
genop(s, MKOP_sBx(OP_JMP, s->loop->pc2 - s->pc));
}
if (val) push();
break;
case NODE_RETRY:
@@ -2064,6 +2065,7 @@ codegen(codegen_scope *s, node *tree, int val)
genop(s, MKOP_sBx(OP_JMP, lp->pc1 - s->pc));
}
}
if (val) push();
}
break;
+18
View File
@@ -13,3 +13,21 @@ end
assert('empty condition in ternary expression parses correctly') do
assert_equal(() ? 1 : 2, 2)
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