avm1: Simplify `SuperObject::from_this_and_base_proto`
This commit is contained in:
parent
1bd46c6d59
commit
dff74dcb92
|
@ -268,14 +268,7 @@ impl<'gc> Executable<'gc> {
|
||||||
let argcell = arguments.into();
|
let argcell = arguments.into();
|
||||||
let super_object: Option<Object<'gc>> =
|
let super_object: Option<Object<'gc>> =
|
||||||
if !af.flags.contains(FunctionFlags::SUPPRESS_SUPER) {
|
if !af.flags.contains(FunctionFlags::SUPPRESS_SUPER) {
|
||||||
Some(
|
Some(SuperObject::new(activation, this, base_proto.unwrap_or(this)).into())
|
||||||
SuperObject::from_this_and_base_proto(
|
|
||||||
this,
|
|
||||||
base_proto.unwrap_or(this),
|
|
||||||
activation,
|
|
||||||
)?
|
|
||||||
.into(),
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,18 +35,18 @@ impl<'gc> SuperObject<'gc> {
|
||||||
/// Construct a `super` for an incoming stack frame.
|
/// Construct a `super` for an incoming stack frame.
|
||||||
///
|
///
|
||||||
/// `this` and `base_proto` must be the values provided to `Executable::exec`.
|
/// `this` and `base_proto` must be the values provided to `Executable::exec`.
|
||||||
pub fn from_this_and_base_proto(
|
pub fn new(
|
||||||
|
activation: &mut Activation<'_, 'gc, '_>,
|
||||||
this: Object<'gc>,
|
this: Object<'gc>,
|
||||||
base_proto: Object<'gc>,
|
base_proto: Object<'gc>,
|
||||||
activation: &mut Activation<'_, 'gc, '_>,
|
) -> Self {
|
||||||
) -> Result<Self, Error<'gc>> {
|
Self(GcCell::allocate(
|
||||||
Ok(Self(GcCell::allocate(
|
|
||||||
activation.context.gc_context,
|
activation.context.gc_context,
|
||||||
SuperObjectData {
|
SuperObjectData {
|
||||||
child: this,
|
child: this,
|
||||||
base_proto,
|
base_proto,
|
||||||
},
|
},
|
||||||
)))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieve the constructor associated with the super proto.
|
/// Retrieve the constructor associated with the super proto.
|
||||||
|
|
Loading…
Reference in New Issue