Skip to content

Commit 0696124

Browse files
committed
Fix unarynot
1 parent 50763ce commit 0696124

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/jit/src/instructions.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,10 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
642642
Ok(())
643643
}
644644
Instruction::UnaryNot => {
645-
let boolean = self.stack.pop().ok_or(JitCompileError::BadBytecode)?;
645+
let boolean = match self.stack.pop().ok_or(JitCompileError::BadBytecode)? {
646+
JitValue::Bool(val) => val,
647+
_ => return Err(JitCompileError::BadBytecode),
648+
};
646649
let not_boolean = self.builder.ins().bxor_imm(boolean, 1);
647650
self.stack.push(JitValue::Bool(not_boolean));
648651
Ok(())

0 commit comments

Comments
 (0)