diff --git a/core/src/avm2/activation.rs b/core/src/avm2/activation.rs index e841867cb..20a7bda5e 100644 --- a/core/src/avm2/activation.rs +++ b/core/src/avm2/activation.rs @@ -1377,7 +1377,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> { fn op_get_slot(&mut self, index: u32) -> Result, Error> { let object = self.context.avm2.pop().coerce_to_object(self)?; - let value = object.get_slot(self, index)?; + let value = object.get_slot(index)?; self.context.avm2.push(value); @@ -1388,13 +1388,13 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> { let value = self.context.avm2.pop(); let object = self.context.avm2.pop().coerce_to_object(self)?; - object.set_slot(self, index, value)?; + object.set_slot(index, value, self.context.gc_context)?; Ok(FrameControl::Continue) } fn op_get_global_slot(&mut self, index: u32) -> Result, Error> { - let value = self.scope.unwrap().read().globals().get_slot(self, index)?; + let value = self.scope.unwrap().read().globals().get_slot(index)?; self.context.avm2.push(value); @@ -1408,7 +1408,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> { .unwrap() .read() .globals() - .set_slot(self, index, value)?; + .set_slot(index, value, self.context.gc_context)?; Ok(FrameControl::Continue) } diff --git a/core/src/avm2/object.rs b/core/src/avm2/object.rs index fb8f7cc9f..6caaffe35 100644 --- a/core/src/avm2/object.rs +++ b/core/src/avm2/object.rs @@ -188,31 +188,10 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into> + Clone + Copy } /// Retrieve a slot by its index. - #[allow(unused_mut)] - fn get_slot( - mut self, - activation: &mut Activation<'_, 'gc, '_>, - id: u32, - ) -> Result, Error> { - self.get_slot_local(id) - } - - /// Retrieve a slot by its index, ignoring uninstalled traits. - fn get_slot_local(self, id: u32) -> Result, Error>; + fn get_slot(self, id: u32) -> Result, Error>; /// Set a slot by its index. - #[allow(unused_mut)] fn set_slot( - mut self, - activation: &mut Activation<'_, 'gc, '_>, - id: u32, - value: Value<'gc>, - ) -> Result<(), Error> { - self.set_slot_local(id, value, activation.context.gc_context) - } - - /// Set a slot by its index, ignoring uninstalled traits. - fn set_slot_local( self, id: u32, value: Value<'gc>, @@ -220,18 +199,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into> + Clone + Copy ) -> Result<(), Error>; /// Initialize a slot by its index. - #[allow(unused_mut)] fn init_slot( - mut self, - activation: &mut Activation<'_, 'gc, '_>, - id: u32, - value: Value<'gc>, - ) -> Result<(), Error> { - self.init_slot_local(id, value, activation.context.gc_context) - } - - /// Initialize a slot by its index, ignoring uninstalled traits. - fn init_slot_local( self, id: u32, value: Value<'gc>, diff --git a/core/src/avm2/object/custom_object.rs b/core/src/avm2/object/custom_object.rs index b6779e10d..bb474bd38 100644 --- a/core/src/avm2/object/custom_object.rs +++ b/core/src/avm2/object/custom_object.rs @@ -94,26 +94,26 @@ macro_rules! impl_avm2_custom_object_properties { #[macro_export] macro_rules! impl_avm2_custom_object { ($field:ident) => { - fn get_slot_local(self, id: u32) -> Result, Error> { - self.0.read().$field.get_slot_local(id) + fn get_slot(self, id: u32) -> Result, Error> { + self.0.read().$field.get_slot(id) } - fn set_slot_local( + fn set_slot( self, id: u32, value: Value<'gc>, mc: MutationContext<'gc, '_>, ) -> Result<(), Error> { - self.0.write(mc).$field.set_slot_local(id, value, mc) + self.0.write(mc).$field.set_slot(id, value, mc) } - fn init_slot_local( + fn init_slot( self, id: u32, value: Value<'gc>, mc: MutationContext<'gc, '_>, ) -> Result<(), Error> { - self.0.write(mc).$field.init_slot_local(id, value, mc) + self.0.write(mc).$field.init_slot(id, value, mc) } fn get_method(self, id: u32) -> Option> { diff --git a/core/src/avm2/object/script_object.rs b/core/src/avm2/object/script_object.rs index 15176bd5b..66d24b2a4 100644 --- a/core/src/avm2/object/script_object.rs +++ b/core/src/avm2/object/script_object.rs @@ -133,26 +133,26 @@ impl<'gc> TObject<'gc> for ScriptObject<'gc> { self.0.write(gc_context).delete_property(name) } - fn get_slot_local(self, id: u32) -> Result, Error> { - self.0.read().get_slot_local(id) + fn get_slot(self, id: u32) -> Result, Error> { + self.0.read().get_slot(id) } - fn set_slot_local( + fn set_slot( self, id: u32, value: Value<'gc>, mc: MutationContext<'gc, '_>, ) -> Result<(), Error> { - self.0.write(mc).set_slot_local(id, value, mc) + self.0.write(mc).set_slot(id, value, mc) } - fn init_slot_local( + fn init_slot( self, id: u32, value: Value<'gc>, mc: MutationContext<'gc, '_>, ) -> Result<(), Error> { - self.0.write(mc).init_slot_local(id, value, mc) + self.0.write(mc).init_slot(id, value, mc) } fn get_method(self, id: u32) -> Option> { @@ -409,9 +409,7 @@ impl<'gc> ScriptObjectData<'gc> { }; if let Some(slot_id) = slot_id { - // This doesn't need the non-local version of this property because - // by the time this has called the slot was already installed - self.set_slot_local(slot_id, value, activation.context.gc_context)?; + self.set_slot(slot_id, value, activation.context.gc_context)?; Ok(Value::Undefined.into()) } else if self.values.contains_key(name) { let prop = self.values.get_mut(name).unwrap(); @@ -440,10 +438,7 @@ impl<'gc> ScriptObjectData<'gc> { let constr = self.as_constr(); if let Some(prop) = self.values.get_mut(name) { if let Some(slot_id) = prop.slot_id() { - // This doesn't need the non-local version of this property - // because by the time this has called the slot was already - // installed - self.init_slot_local(slot_id, value, activation.context.gc_context)?; + self.init_slot(slot_id, value, activation.context.gc_context)?; Ok(Value::Undefined.into()) } else { prop.init( @@ -482,7 +477,7 @@ impl<'gc> ScriptObjectData<'gc> { can_delete } - pub fn get_slot_local(&self, id: u32) -> Result, Error> { + pub fn get_slot(&self, id: u32) -> Result, Error> { self.slots .get(id as usize) .cloned() @@ -491,7 +486,7 @@ impl<'gc> ScriptObjectData<'gc> { } /// Set a slot by its index. - pub fn set_slot_local( + pub fn set_slot( &mut self, id: u32, value: Value<'gc>, @@ -505,7 +500,7 @@ impl<'gc> ScriptObjectData<'gc> { } /// Initialize a slot by its index. - pub fn init_slot_local( + pub fn init_slot( &mut self, id: u32, value: Value<'gc>, diff --git a/core/src/avm2/object/stage_object.rs b/core/src/avm2/object/stage_object.rs index 67bde9d0b..509784b28 100644 --- a/core/src/avm2/object/stage_object.rs +++ b/core/src/avm2/object/stage_object.rs @@ -195,26 +195,26 @@ impl<'gc> TObject<'gc> for StageObject<'gc> { self.0.write(gc_context).base.delete_property(multiname) } - fn get_slot_local(self, id: u32) -> Result, Error> { - self.0.read().base.get_slot_local(id) + fn get_slot(self, id: u32) -> Result, Error> { + self.0.read().base.get_slot(id) } - fn set_slot_local( + fn set_slot( self, id: u32, value: Value<'gc>, mc: MutationContext<'gc, '_>, ) -> Result<(), Error> { - self.0.write(mc).base.set_slot_local(id, value, mc) + self.0.write(mc).base.set_slot(id, value, mc) } - fn init_slot_local( + fn init_slot( self, id: u32, value: Value<'gc>, mc: MutationContext<'gc, '_>, ) -> Result<(), Error> { - self.0.write(mc).base.init_slot_local(id, value, mc) + self.0.write(mc).base.init_slot(id, value, mc) } fn get_method(self, id: u32) -> Option> { diff --git a/core/src/avm2/property.rs b/core/src/avm2/property.rs index 7c59210b2..433c1b608 100644 --- a/core/src/avm2/property.rs +++ b/core/src/avm2/property.rs @@ -145,7 +145,7 @@ impl<'gc> Property<'gc> { // This doesn't need the non-local version of this property because // by the time this has called the slot was already installed - Property::Slot { slot_id, .. } => this.get_slot_local(*slot_id).map(|v| v.into()), + Property::Slot { slot_id, .. } => this.get_slot(*slot_id).map(|v| v.into()), } }