Panic if catch_exception is called incorrectly

This commit is contained in:
Andrew Morris
2024-07-18 16:58:44 +09:00
parent 00ec3c1046
commit 4de719893e

View File

@@ -714,16 +714,19 @@ impl StackFrameTrait for BytecodeStackFrame {
}
fn catch_exception(&mut self, exception: &mut Val) {
if let Some(catch_setting) = &self.catch_setting {
let exception = take(exception);
let catch_setting = self
.catch_setting
.as_ref()
.expect("can_catch_exception should have been checked before calling this");
if let Some(r) = catch_setting.register {
self.registers[r] = exception;
}
let exception = take(exception);
self.decoder.pos = catch_setting.pos;
self.catch_setting = None;
if let Some(r) = catch_setting.register {
self.registers[r] = exception;
}
self.decoder.pos = catch_setting.pos;
self.catch_setting = None;
}
fn clone_to_stack_frame(&self) -> StackFrame {