avm2: Fix some very minor bugs with findprop optimization
This commit is contained in:
parent
796dda1ae0
commit
92de618261
|
@ -265,6 +265,10 @@ pub fn optimize<'gc>(
|
|||
}
|
||||
}
|
||||
|
||||
if !method_body.exceptions.is_empty() {
|
||||
has_simple_scoping = false;
|
||||
}
|
||||
|
||||
// TODO: Fill out all ops, then add scope stack and stack merging, too
|
||||
let mut state_map: HashMap<i32, Locals<'gc>> = HashMap::new();
|
||||
|
||||
|
@ -769,17 +773,20 @@ pub fn optimize<'gc>(
|
|||
}
|
||||
|
||||
if !stack_push_done {
|
||||
if let Some((class, index)) =
|
||||
outer_scope.get_entry_for_multiname(&multiname)
|
||||
{
|
||||
*op = Op::GetOuterScope {
|
||||
index: index as u32,
|
||||
};
|
||||
if let Some(info) = outer_scope.get_entry_for_multiname(&multiname) {
|
||||
if let Some((class, index)) = info {
|
||||
*op = Op::GetOuterScope {
|
||||
index: index as u32,
|
||||
};
|
||||
|
||||
stack_push_done = true;
|
||||
if let Some(class) = class {
|
||||
stack.push_class_object(class);
|
||||
stack_push_done = true;
|
||||
if let Some(class) = class {
|
||||
stack.push_class_object(class);
|
||||
} else {
|
||||
stack.push_any();
|
||||
}
|
||||
} else {
|
||||
stack_push_done = true;
|
||||
stack.push_any();
|
||||
}
|
||||
}
|
||||
|
@ -791,7 +798,6 @@ pub fn optimize<'gc>(
|
|||
{
|
||||
*op = Op::GetScriptGlobals { script };
|
||||
|
||||
|
||||
let script_globals = script
|
||||
.globals(&mut activation.context)
|
||||
.expect("Script should be resolved if traits exist");
|
||||
|
|
|
@ -237,18 +237,18 @@ impl<'gc> ScopeChain<'gc> {
|
|||
pub fn get_entry_for_multiname(
|
||||
&self,
|
||||
multiname: &Multiname<'gc>,
|
||||
) -> Option<(Option<ClassObject<'gc>>, u32)> {
|
||||
) -> Option<Option<(Option<ClassObject<'gc>>, u32)>> {
|
||||
if let Some(container) = self.container {
|
||||
for (index, scope) in container.scopes.iter().enumerate().skip(1).rev() {
|
||||
if scope.with() {
|
||||
// If this is a `with` scope, stop here because
|
||||
// dynamic properties could be added at any time
|
||||
return None;
|
||||
return Some(None);
|
||||
}
|
||||
|
||||
let values = scope.values();
|
||||
if values.has_trait(&multiname) {
|
||||
return Some((values.instance_of(), index as u32));
|
||||
return Some(Some((values.instance_of(), index as u32)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue