@@ -10,7 +10,7 @@ use crate::avm1::{ArrayObject, Object, ObjectPtr, ScriptObject, TObject};
10
10
use crate :: display_object:: { DisplayObject , TDisplayObject } ;
11
11
use crate :: string:: { AvmString , StringContext , SwfStrExt as _} ;
12
12
use crate :: tag_utils:: SwfSlice ;
13
- use gc_arena:: { Collect , Gc , GcCell , Mutation } ;
13
+ use gc_arena:: { Collect , Gc , Mutation } ;
14
14
use ruffle_macros:: istr;
15
15
use std:: { borrow:: Cow , fmt, num:: NonZeroU8 } ;
16
16
use swf:: { avm1:: types:: FunctionFlags , SwfStr } ;
@@ -488,12 +488,12 @@ impl<'gc> From<Gc<'gc, Avm1Function<'gc>>> for Executable<'gc> {
488
488
/// Represents an `Object` that holds executable code.
489
489
#[ derive( Clone , Collect , Copy ) ]
490
490
#[ collect( no_drop) ]
491
- pub struct FunctionObject < ' gc > ( GcCell < ' gc , FunctionObjectData < ' gc > > ) ;
491
+ pub struct FunctionObject < ' gc > ( Gc < ' gc , FunctionObjectData < ' gc > > ) ;
492
492
493
493
impl fmt:: Debug for FunctionObject < ' _ > {
494
494
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
495
495
f. debug_struct ( "FunctionObject" )
496
- . field ( "ptr" , & self . 0 . as_ptr ( ) )
496
+ . field ( "ptr" , & Gc :: as_ptr ( self . 0 ) )
497
497
. finish ( )
498
498
}
499
499
}
@@ -517,7 +517,7 @@ impl<'gc> FunctionObject<'gc> {
517
517
constructor : Option < Executable < ' gc > > ,
518
518
fn_proto : Object < ' gc > ,
519
519
) -> Self {
520
- Self ( GcCell :: new (
520
+ Self ( Gc :: new (
521
521
context. gc ( ) ,
522
522
FunctionObjectData {
523
523
base : ScriptObject :: new ( context, Some ( fn_proto) ) ,
@@ -590,7 +590,7 @@ impl<'gc> FunctionObject<'gc> {
590
590
591
591
impl < ' gc > TObject < ' gc > for FunctionObject < ' gc > {
592
592
fn raw_script_object ( & self ) -> ScriptObject < ' gc > {
593
- self . 0 . read ( ) . base
593
+ self . 0 . base
594
594
}
595
595
596
596
fn call (
@@ -635,7 +635,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
635
635
) ;
636
636
}
637
637
// TODO: de-duplicate code.
638
- if let Some ( exec) = & self . 0 . read ( ) . constructor {
638
+ if let Some ( exec) = & self . 0 . constructor {
639
639
let _ = exec. exec (
640
640
ExecutionName :: Static ( "[ctor]" ) ,
641
641
activation,
@@ -645,7 +645,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
645
645
ExecutionReason :: FunctionCall ,
646
646
( * self ) . into ( ) ,
647
647
) ?;
648
- } else if let Some ( exec) = & self . 0 . read ( ) . function {
648
+ } else if let Some ( exec) = & self . 0 . function {
649
649
let _ = exec. exec (
650
650
ExecutionName :: Static ( "[ctor]" ) ,
651
651
activation,
@@ -684,7 +684,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
684
684
) ;
685
685
}
686
686
// TODO: de-duplicate code.
687
- if let Some ( exec) = & self . 0 . read ( ) . constructor {
687
+ if let Some ( exec) = & self . 0 . constructor {
688
688
// Native constructors will return the constructed `this`.
689
689
// This allows for `new Object` etc. returning different types.
690
690
let this = exec. exec (
@@ -697,7 +697,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
697
697
( * self ) . into ( ) ,
698
698
) ?;
699
699
Ok ( this)
700
- } else if let Some ( exec) = & self . 0 . read ( ) . function {
700
+ } else if let Some ( exec) = & self . 0 . function {
701
701
let _ = exec. exec (
702
702
ExecutionName :: Static ( "[ctor]" ) ,
703
703
activation,
@@ -718,7 +718,7 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
718
718
activation : & mut Activation < ' _ , ' gc > ,
719
719
prototype : Object < ' gc > ,
720
720
) -> Result < Object < ' gc > , Error < ' gc > > {
721
- Ok ( FunctionObject ( GcCell :: new (
721
+ Ok ( FunctionObject ( Gc :: new (
722
722
activation. gc ( ) ,
723
723
FunctionObjectData {
724
724
base : ScriptObject :: new ( & activation. context . strings , Some ( prototype) ) ,
@@ -730,11 +730,11 @@ impl<'gc> TObject<'gc> for FunctionObject<'gc> {
730
730
}
731
731
732
732
fn as_executable ( & self ) -> Option < Executable < ' gc > > {
733
- self . 0 . read ( ) . function . clone ( )
733
+ self . 0 . function . clone ( )
734
734
}
735
735
736
736
fn as_ptr ( & self ) -> * const ObjectPtr {
737
- self . 0 . read ( ) . base . as_ptr ( )
737
+ self . 0 . base . as_ptr ( )
738
738
}
739
739
}
740
740
0 commit comments