avm1: TObject::create_bare_object doesn't use or need args
This commit is contained in:
parent
79af3ffe44
commit
db4f5007f3
|
@ -621,7 +621,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
let prototype = self
|
||||
.get("prototype", activation, context)?
|
||||
.coerce_to_object(activation, context);
|
||||
let this = prototype.create_bare_object(activation, context, prototype, args)?;
|
||||
let this = prototype.create_bare_object(activation, context, prototype)?;
|
||||
self.construct_on_existing(activation, context, this, args)?;
|
||||
Ok(this)
|
||||
}
|
||||
|
@ -642,7 +642,6 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
prototype: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
let base = ScriptObject::object(context.gc_context, Some(prototype));
|
||||
let fn_object = FunctionObject {
|
||||
|
|
|
@ -185,16 +185,11 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// object implementation it wants, with itself as the new object's proto.
|
||||
/// Then, the constructor is `call`ed with the new object as `this` to
|
||||
/// initialize the object.
|
||||
///
|
||||
/// The arguments passed to the constructor are provided here; however, all
|
||||
/// object construction should happen in `call`, not `new`. `new` exists
|
||||
/// purely so that host objects can be constructed by the VM.
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>>;
|
||||
|
||||
/// Delete a named property from the object.
|
||||
|
|
|
@ -123,7 +123,6 @@ impl<'gc> TObject<'gc> for ColorTransformObject<'gc> {
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(ColorTransformObject::empty_color_transform_object(
|
||||
context.gc_context,
|
||||
|
|
|
@ -508,7 +508,6 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
match self.0.read().array {
|
||||
ArrayStorage::Vector(_) => {
|
||||
|
|
|
@ -3,7 +3,7 @@ use gc_arena::{Collect, GcCell, MutationContext};
|
|||
|
||||
use crate::avm1::activation::Activation;
|
||||
use crate::avm1::error::Error;
|
||||
use crate::avm1::{Object, ScriptObject, TObject, Value};
|
||||
use crate::avm1::{Object, ScriptObject, TObject};
|
||||
use crate::context::UpdateContext;
|
||||
use std::fmt;
|
||||
|
||||
|
@ -69,7 +69,6 @@ impl<'gc> TObject<'gc> for SharedObject<'gc> {
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(SharedObject::empty_shared_obj(
|
||||
context.gc_context,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::avm1::activation::Activation;
|
||||
use crate::avm1::error::Error;
|
||||
use crate::avm1::{Object, ScriptObject, TObject, Value};
|
||||
use crate::avm1::{Object, ScriptObject, TObject};
|
||||
use crate::backend::audio::{SoundHandle, SoundInstanceHandle};
|
||||
use crate::context::UpdateContext;
|
||||
use crate::display_object::DisplayObject;
|
||||
|
@ -132,7 +132,6 @@ impl<'gc> TObject<'gc> for SoundObject<'gc> {
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(
|
||||
SoundObject::empty_sound(context.gc_context, Some(activation.avm.prototypes.sound))
|
||||
|
|
|
@ -253,13 +253,12 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
//TODO: Create a StageObject of some kind
|
||||
self.0
|
||||
.read()
|
||||
.base
|
||||
.create_bare_object(activation, context, this, args)
|
||||
.create_bare_object(activation, context, this)
|
||||
}
|
||||
|
||||
fn delete(
|
||||
|
|
|
@ -164,17 +164,16 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
if let Some(proto) = self.proto() {
|
||||
proto.create_bare_object(activation, context, this, args)
|
||||
proto.create_bare_object(activation, context, this)
|
||||
} else {
|
||||
// TODO: What happens when you `new super` but there's no
|
||||
// super? Is this code even reachable?!
|
||||
self.0
|
||||
.read()
|
||||
.child
|
||||
.create_bare_object(activation, context, this, args)
|
||||
.create_bare_object(activation, context, this)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,6 @@ impl<'gc> TObject<'gc> for ValueObject<'gc> {
|
|||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(ValueObject::empty_box(context.gc_context, Some(this)))
|
||||
}
|
||||
|
|
|
@ -114,7 +114,6 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
//TODO: `new xmlnode.attributes()` returns undefined, not an object
|
||||
avm_warn!(activation, "Cannot create new XML Attributes object");
|
||||
|
|
|
@ -114,7 +114,6 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
_this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
//TODO: `new xmlnode.attributes()` returns undefined, not an object
|
||||
avm_warn!(activation, "Cannot create new XML Attributes object");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use crate::avm1::activation::Activation;
|
||||
use crate::avm1::error::Error;
|
||||
use crate::avm1::object::TObject;
|
||||
use crate::avm1::{Object, ScriptObject, UpdateContext, Value};
|
||||
use crate::avm1::{Object, ScriptObject, UpdateContext};
|
||||
use crate::impl_custom_object;
|
||||
use crate::xml::{XMLDocument, XMLNode};
|
||||
use gc_arena::{Collect, GcCell, MutationContext};
|
||||
|
@ -80,7 +80,6 @@ impl<'gc> TObject<'gc> for XMLObject<'gc> {
|
|||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
this: Object<'gc>,
|
||||
_args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
Ok(XMLObject::empty_node(context.gc_context, Some(this)))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue