Represent register taking

This commit is contained in:
Andrew Morris
2023-06-20 16:57:49 +10:00
parent 39ccf8f35c
commit 72f9fbf0f7
11 changed files with 143 additions and 87 deletions

View File

@@ -39,6 +39,7 @@ pub enum BytecodeType {
Function = 0x0b,
Pointer = 0x0d,
Register = 0x0e,
TakeRegister = 0x0f,
Builtin = 0x10,
Class = 0x11,
BigInt = 0x13,
@@ -142,6 +143,10 @@ impl BytecodeDecoder {
Val::Void => Own(Val::Undefined),
ref val => Ref(val),
},
BytecodeType::TakeRegister => match registers[self.decode_register_index().unwrap()] {
Val::Void => Own(Val::Undefined),
ref val => Ref(val),
},
BytecodeType::Builtin => Own(BUILTIN_VALS[self.decode_varsize_uint()]()),
BytecodeType::Class => Own(
VsClass {