mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Add set_catch, unset_catch instructions
This commit is contained in:
@@ -20,6 +20,12 @@ pub struct BytecodeStackFrame {
|
||||
pub param_end: usize,
|
||||
pub this_target: Option<usize>,
|
||||
pub return_target: Option<usize>,
|
||||
pub catch_setting: Option<CatchSetting>,
|
||||
}
|
||||
|
||||
pub struct CatchSetting {
|
||||
pub pos: usize,
|
||||
pub register: Option<usize>,
|
||||
}
|
||||
|
||||
impl BytecodeStackFrame {
|
||||
@@ -404,6 +410,17 @@ impl StackFrameTrait for BytecodeStackFrame {
|
||||
Import | ImportStar => {
|
||||
panic!("TODO: Dynamic imports")
|
||||
}
|
||||
|
||||
SetCatch => {
|
||||
self.catch_setting = Some(CatchSetting {
|
||||
pos: self.decoder.decode_pos(),
|
||||
register: self.decoder.decode_register_index(),
|
||||
});
|
||||
}
|
||||
|
||||
UnsetCatch => {
|
||||
self.catch_setting = None;
|
||||
}
|
||||
};
|
||||
|
||||
Ok(FrameStepOk::Continue)
|
||||
|
||||
@@ -50,11 +50,12 @@ impl VsFunction {
|
||||
data: self.bytecode.clone(),
|
||||
pos: self.start,
|
||||
},
|
||||
registers: registers,
|
||||
registers,
|
||||
param_start: self.binds.len() + 2,
|
||||
param_end: self.parameter_count + 2,
|
||||
this_target: None,
|
||||
return_target: None,
|
||||
catch_setting: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user