avm2: Resolve review comments and use `activation.gc()` in some places

This commit is contained in:
Lord-McSweeney 2024-07-31 15:58:31 -07:00 committed by Lord-McSweeney
parent 8f6736da74
commit c54de07382
4 changed files with 12 additions and 14 deletions

View File

@ -164,7 +164,7 @@ impl<'gc> TObject<'gc> for ByteArrayObject<'gc> {
}
unlock!(
Gc::write(activation.context.gc_context, self.0),
Gc::write(activation.gc(), self.0),
ByteArrayObjectData,
base
)
@ -192,7 +192,7 @@ impl<'gc> TObject<'gc> for ByteArrayObject<'gc> {
}
unlock!(
Gc::write(activation.context.gc_context, self.0),
Gc::write(activation.gc(), self.0),
ByteArrayObjectData,
base
)
@ -215,7 +215,7 @@ impl<'gc> TObject<'gc> for ByteArrayObject<'gc> {
}
Ok(unlock!(
Gc::write(activation.context.gc_context, self.0),
Gc::write(activation.gc(), self.0),
ByteArrayObjectData,
base
)

View File

@ -27,10 +27,7 @@ pub fn error_allocator<'gc>(
Ok(ErrorObject(Gc::new(
activation.context.gc_context,
ErrorObjectData {
base,
call_stack: RefLock::new(call_stack),
},
ErrorObjectData { base, call_stack },
))
.into())
}
@ -58,7 +55,7 @@ pub struct ErrorObjectData<'gc> {
/// Base script object
base: RefLock<ScriptObjectData<'gc>>,
call_stack: RefLock<CallStack<'gc>>,
call_stack: CallStack<'gc>,
}
impl<'gc> ErrorObject<'gc> {
@ -107,8 +104,8 @@ impl<'gc> ErrorObject<'gc> {
Ok(output)
}
pub fn call_stack(&self) -> Ref<CallStack<'gc>> {
self.0.call_stack.borrow()
pub fn call_stack(&self) -> &CallStack<'gc> {
&self.0.call_stack
}
fn debug_class_name(&self) -> Box<dyn Debug + 'gc> {

View File

@ -76,8 +76,9 @@ impl<'gc> ResponderObject<'gc> {
result: Option<FunctionObject<'gc>>,
status: Option<FunctionObject<'gc>>,
) {
unlock!(Gc::write(mc, self.0), ResponderObjectData, result).set(result);
unlock!(Gc::write(mc, self.0), ResponderObjectData, status).set(status);
let write = Gc::write(mc, self.0);
unlock!(write, ResponderObjectData, result).set(result);
unlock!(write, ResponderObjectData, status).set(status);
}
pub fn send_callback(

View File

@ -121,11 +121,11 @@ impl<'gc> XmlListObject<'gc> {
*unlock!(Gc::write(mc, self.0), XmlListObjectData, children).borrow_mut() = children;
}
pub fn target_object(&self) -> Option<XmlOrXmlListObject<'gc>> {
fn target_object(&self) -> Option<XmlOrXmlListObject<'gc>> {
self.0.target_object.get()
}
pub fn target_property(&self) -> Option<Multiname<'gc>> {
fn target_property(&self) -> Option<Multiname<'gc>> {
self.0.target_property.borrow().clone()
}