fix(tvix/eval): make ||
propagate catchables
Change-Id: I42f994d7c9228368d5f6c30c4730c24666f7bc69 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10320 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
7b9eea71d0
commit
bcc1ea8552
3 changed files with 4 additions and 0 deletions
|
@ -572,6 +572,7 @@ impl Compiler<'_> {
|
||||||
self.compile(slot, node.lhs().unwrap());
|
self.compile(slot, node.lhs().unwrap());
|
||||||
self.emit_force(&node.lhs().unwrap());
|
self.emit_force(&node.lhs().unwrap());
|
||||||
|
|
||||||
|
let throw_idx = self.push_op(OpCode::OpJumpIfCatchable(JumpOffset(0)), node);
|
||||||
// Opposite of above: If this value is **true**, we can
|
// Opposite of above: If this value is **true**, we can
|
||||||
// short-circuit the right-hand side.
|
// short-circuit the right-hand side.
|
||||||
let end_idx = self.push_op(OpCode::OpJumpIfTrue(JumpOffset(0)), node);
|
let end_idx = self.push_op(OpCode::OpJumpIfTrue(JumpOffset(0)), node);
|
||||||
|
@ -581,6 +582,7 @@ impl Compiler<'_> {
|
||||||
|
|
||||||
self.patch_jump(end_idx);
|
self.patch_jump(end_idx);
|
||||||
self.push_op(OpCode::OpAssertBool, node);
|
self.push_op(OpCode::OpAssertBool, node);
|
||||||
|
self.patch_jump(throw_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_implication(&mut self, slot: LocalIdx, node: &ast::BinOp) {
|
fn compile_implication(&mut self, slot: LocalIdx, node: &ast::BinOp) {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
false
|
|
@ -0,0 +1 @@
|
||||||
|
(builtins.tryEval ( (throw "fred") || (throw "jill") )).success
|
Loading…
Reference in a new issue