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 super_object: Option<Object<'gc>> =
|
||||
if !af.flags.contains(FunctionFlags::SUPPRESS_SUPER) {
|
||||
Some(
|
||||
SuperObject::from_this_and_base_proto(
|
||||
this,
|
||||
base_proto.unwrap_or(this),
|
||||
activation,
|
||||
)?
|
||||
.into(),
|
||||
)
|
||||
Some(SuperObject::new(activation, this, base_proto.unwrap_or(this)).into())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
|
@ -35,18 +35,18 @@ impl<'gc> SuperObject<'gc> {
|
|||
/// Construct a `super` for an incoming stack frame.
|
||||
///
|
||||
/// `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>,
|
||||
base_proto: Object<'gc>,
|
||||
activation: &mut Activation<'_, 'gc, '_>,
|
||||
) -> Result<Self, Error<'gc>> {
|
||||
Ok(Self(GcCell::allocate(
|
||||
) -> Self {
|
||||
Self(GcCell::allocate(
|
||||
activation.context.gc_context,
|
||||
SuperObjectData {
|
||||
child: this,
|
||||
base_proto,
|
||||
},
|
||||
)))
|
||||
))
|
||||
}
|
||||
|
||||
/// Retrieve the constructor associated with the super proto.
|
||||
|
|
Loading…
Reference in New Issue