mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
resolve conflict; ref #3285
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user