avm1: Rename TObject::new to TObject::create_bare_object
This commit is contained in:
parent
2131f7860b
commit
79af3ffe44
|
@ -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.new(activation, context, prototype, args)?;
|
||||
let this = prototype.create_bare_object(activation, context, prototype, args)?;
|
||||
self.construct_on_existing(activation, context, this, args)?;
|
||||
Ok(this)
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
|
|||
}
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -189,7 +189,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
|||
/// 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 new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -118,7 +118,7 @@ impl<'gc> TObject<'gc> for ColorTransformObject<'gc> {
|
|||
}
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -503,7 +503,7 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> {
|
|||
}
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -64,7 +64,7 @@ impl<'gc> TObject<'gc> for SharedObject<'gc> {
|
|||
impl_custom_object!(base);
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -127,7 +127,7 @@ impl<'gc> TObject<'gc> for SoundObject<'gc> {
|
|||
impl_custom_object!(base);
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -248,7 +248,7 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
}
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
@ -256,7 +256,10 @@ impl<'gc> TObject<'gc> for StageObject<'gc> {
|
|||
args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
//TODO: Create a StageObject of some kind
|
||||
self.0.read().base.new(activation, context, this, args)
|
||||
self.0
|
||||
.read()
|
||||
.base
|
||||
.create_bare_object(activation, context, this, args)
|
||||
}
|
||||
|
||||
fn delete(
|
||||
|
|
|
@ -159,7 +159,7 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
}
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
@ -167,11 +167,14 @@ impl<'gc> TObject<'gc> for SuperObject<'gc> {
|
|||
args: &[Value<'gc>],
|
||||
) -> Result<Object<'gc>, Error<'gc>> {
|
||||
if let Some(proto) = self.proto() {
|
||||
proto.new(activation, context, this, args)
|
||||
proto.create_bare_object(activation, context, this, args)
|
||||
} else {
|
||||
// TODO: What happens when you `new super` but there's no
|
||||
// super? Is this code even reachable?!
|
||||
self.0.read().child.new(activation, context, this, args)
|
||||
self.0
|
||||
.read()
|
||||
.child
|
||||
.create_bare_object(activation, context, this, args)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ impl<'gc> TObject<'gc> for ValueObject<'gc> {
|
|||
impl_custom_object!(base);
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -109,7 +109,7 @@ impl<'gc> TObject<'gc> for XMLAttributesObject<'gc> {
|
|||
}
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -109,7 +109,7 @@ impl<'gc> TObject<'gc> for XMLIDMapObject<'gc> {
|
|||
}
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
|
@ -75,7 +75,7 @@ impl<'gc> TObject<'gc> for XMLObject<'gc> {
|
|||
impl_custom_object!(base);
|
||||
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
fn create_bare_object(
|
||||
&self,
|
||||
_activation: &mut Activation<'_, 'gc>,
|
||||
context: &mut UpdateContext<'_, 'gc, '_>,
|
||||
|
|
Loading…
Reference in New Issue