mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-14 07:57:57 -05: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)
|
||||
|
||||
Reference in New Issue
Block a user