avm2: Remove prototype lookups from `resolve_any`

This commit is contained in:
David Wendt 2021-11-20 20:36:57 -05:00 committed by kmeisthax
parent d83a7c909c
commit 0bc2ddfc7b
3 changed files with 0 additions and 52 deletions

View File

@ -604,20 +604,6 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
base.resolve_any(local_name)
}
/// Given a local name of a trait, find the namespace it resides in, if any.
///
/// This function only works for names which are trait properties, not
/// dynamic or prototype properties. Furthermore, instance prototypes *will*
/// resolve trait names here, contrary to their behavior in `resolve_any.`
fn resolve_any_trait(
self,
local_name: AvmString<'gc>,
) -> Result<Option<Namespace<'gc>>, Error> {
let base = self.base();
base.resolve_any_trait(local_name)
}
/// Implements the `in` opcode and AS3 operator.
///
/// By default, this just calls `has_property`, but may be overridden by

View File

@ -1035,20 +1035,6 @@ impl<'gc> TObject<'gc> for ClassObject<'gc> {
read.base.resolve_any(local_name)
}
fn resolve_any_trait(
self,
local_name: AvmString<'gc>,
) -> Result<Option<Namespace<'gc>>, Error> {
let read = self.0.read();
let class = read.class.read();
if let Some(ns) = class.resolve_any_class_trait(local_name) {
return Ok(Some(ns));
}
read.base.resolve_any_trait(local_name)
}
fn as_class_object(&self) -> Option<ClassObject<'gc>> {
Some(*self)
}

View File

@ -309,30 +309,6 @@ impl<'gc> ScriptObjectData<'gc> {
}
}
let trait_ns = self.resolve_any_trait(local_name)?;
if trait_ns.is_none() {
if let Some(proto) = self.proto() {
proto.resolve_any(local_name)
} else {
Ok(None)
}
} else {
Ok(trait_ns)
}
}
pub fn resolve_any_trait(
&self,
local_name: AvmString<'gc>,
) -> Result<Option<Namespace<'gc>>, Error> {
if let Some(proto) = self.proto {
let proto_trait_name = proto.resolve_any_trait(local_name)?;
if let Some(ns) = proto_trait_name {
return Ok(Some(ns));
}
}
match &self.instance_of {
Some(class) => {
let mut cur_class = Some(*class);