fix for bug caught in simulator regarding exec_if

This commit is contained in:
pedrocarlo
2025-06-08 19:01:33 -03:00
parent 83d72db901
commit cf34e21ba9

View File

@@ -5521,12 +5521,10 @@ impl Value {
// exec_if returns whether you should jump
pub fn exec_if(&self, jump_if_null: bool, not: bool) -> bool {
match self {
Value::Integer(0) | Value::Float(0.0) => not,
Value::Integer(_) | Value::Float(_) => !not,
Value::Null => jump_if_null,
_ => false,
}
Numeric::from(self)
.try_into_bool()
.map(|jump| if not { !jump } else { jump })
.unwrap_or(jump_if_null)
}
pub fn exec_cast(&self, datatype: &str) -> Value {