Avoid throwing when register is void

This commit is contained in:
Andrew Morris
2023-03-23 10:30:57 +11:00
parent 56b35e06e2
commit 45294cec47
3 changed files with 19 additions and 4 deletions

View File

@@ -132,7 +132,10 @@ impl BytecodeDecoder {
}
BytecodeType::Function => self.decode_function_header(),
BytecodeType::Pointer => self.decode_pointer(),
BytecodeType::Register => registers[self.decode_register_index().unwrap()].clone(),
BytecodeType::Register => match registers[self.decode_register_index().unwrap()].clone() {
Val::Void => Val::Undefined,
val => val,
},
BytecodeType::Builtin => Val::Static(BUILTIN_VALS[self.decode_varsize_uint()]),
BytecodeType::Class => Val::Class(Rc::new(VsClass {
constructor: self.decode_val(registers),