avm2: Ensure `bound_class` is set in `Activation::init_from_method` and remove special case for static methods in optimizer

This commit is contained in:
Lord-McSweeney 2024-08-17 08:59:33 -07:00 committed by Lord-McSweeney
parent 7bea8c90ee
commit 0d37b3de8c
2 changed files with 1 additions and 11 deletions

View File

@ -441,6 +441,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
self.caller_domain = Some(outer.domain());
self.caller_movie = Some(method.owner_movie());
self.bound_superclass_object = bound_superclass_object;
self.bound_class = bound_class;
self.activation_class = activation_class;
self.stack_depth = self.context.avm2.stack.len();
self.scope_depth = self.context.avm2.scope_stack.len();

View File

@ -363,17 +363,6 @@ pub fn optimize<'gc>(
let this_class = if let Some(this_class) = activation.bound_class() {
if this_value.is_of_type(activation, this_class) {
Some(this_class)
} else if let Some(this_object) = this_value.as_object() {
if this_object
.as_class_object()
.map(|c| c.inner_class_definition() == this_class)
.unwrap_or(false)
{
// Static method
Some(this_object.instance_class())
} else {
None
}
} else {
None
}