avm1: Inline `SuperObject::super_constr`
This commit is contained in:
parent
dff74dcb92
commit
90a544a34a
|
@ -48,22 +48,6 @@ impl<'gc> SuperObject<'gc> {
|
|||
},
|
||||
))
|
||||
}
|
||||
|
||||
/// Retrieve the constructor associated with the super proto.
|
||||
fn super_constr(
|
||||
self,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Option<Object<'gc>>, Error<'gc>> {
|
||||
if let Value::Object(super_proto) = self.proto(activation) {
|
||||
Ok(Some(
|
||||
super_proto
|
||||
.get("__constructor__", activation)?
|
||||
.coerce_to_object(activation),
|
||||
))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
||||
|
@ -87,6 +71,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
//TODO: What happens if you set `super.__proto__`?
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn call(
|
||||
&self,
|
||||
name: &str,
|
||||
|
@ -95,12 +80,11 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
_base_proto: Option<Object<'gc>>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
if let Some(constr) = self.super_constr(activation)? {
|
||||
let super_proto = match self.proto(activation) {
|
||||
Value::Object(o) => Some(o),
|
||||
_ => None,
|
||||
};
|
||||
constr.call(name, activation, self.0.read().child, super_proto, args)
|
||||
if let Value::Object(proto) = self.proto(activation) {
|
||||
let constructor = proto
|
||||
.get("__constructor__", activation)?
|
||||
.coerce_to_object(activation);
|
||||
constructor.call(name, activation, self.0.read().child, Some(proto), args)
|
||||
} else {
|
||||
Ok(Value::Undefined)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue