avm2: Inline `Activation::run_stack_frame_for_script`
This reduces some complexity.
This commit is contained in:
parent
af4f181856
commit
cad3cd8dbf
|
@ -138,8 +138,8 @@ impl<'gc> Avm2<'gc> {
|
|||
|
||||
(method.method)(&mut init_activation, Some(scope), &[])?;
|
||||
}
|
||||
Method::Bytecode(_) => {
|
||||
init_activation.run_stack_frame_for_script(script)?;
|
||||
Method::Bytecode(method) => {
|
||||
init_activation.run_actions(method)?;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -528,15 +528,6 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Execute a script initializer.
|
||||
pub fn run_stack_frame_for_script(&mut self, script: Script<'gc>) -> Result<(), Error> {
|
||||
let init = script.init().0.into_bytecode()?;
|
||||
|
||||
self.run_actions(init)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Call the superclass's instance initializer.
|
||||
pub fn super_init(
|
||||
&mut self,
|
||||
|
|
|
@ -353,18 +353,6 @@ impl<'gc> Method<'gc> {
|
|||
))
|
||||
}
|
||||
|
||||
/// Access the bytecode of this method.
|
||||
///
|
||||
/// This function returns `Err` if there is no bytecode for this method.
|
||||
pub fn into_bytecode(self) -> Result<Gc<'gc, BytecodeMethod<'gc>>, Error> {
|
||||
match self {
|
||||
Method::Native { .. } => {
|
||||
Err("Attempted to unwrap a native method as a user-defined one".into())
|
||||
}
|
||||
Method::Bytecode(bm) => Ok(bm),
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if this method needs `arguments`.
|
||||
pub fn needs_arguments_object(&self) -> bool {
|
||||
match self {
|
||||
|
|
Loading…
Reference in New Issue