avm2: Introduce `clear_stack` & `clear_scope`.
This commit is contained in:
parent
98d3b8f3c1
commit
601f36df33
|
@ -692,6 +692,16 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||||
self.avm2().pop_scope(scope_depth)
|
self.avm2().pop_scope(scope_depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn clear_stack(&mut self) {
|
||||||
|
let stack_depth = self.stack_depth;
|
||||||
|
self.avm2().stack.truncate(stack_depth)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn clear_scope(&mut self) {
|
||||||
|
let scope_depth = self.scope_depth;
|
||||||
|
self.avm2().scope_stack.truncate(scope_depth)
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the superclass of the class that defined the currently-executing
|
/// Get the superclass of the class that defined the currently-executing
|
||||||
/// method, if it exists.
|
/// method, if it exists.
|
||||||
///
|
///
|
||||||
|
@ -891,10 +901,10 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches {
|
if matches {
|
||||||
|
self.clear_stack();
|
||||||
self.push_stack(error);
|
self.push_stack(error);
|
||||||
|
|
||||||
let scope_depth = self.scope_depth;
|
self.clear_scope();
|
||||||
self.avm2().scope_stack.truncate(scope_depth);
|
|
||||||
reader.seek_absolute(full_data, e.target_offset as usize);
|
reader.seek_absolute(full_data, e.target_offset as usize);
|
||||||
return Ok(FrameControl::Continue);
|
return Ok(FrameControl::Continue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue