pub fn new_target_scope(
        mut parent: GcCell<'gc, Self>,
        clip: Object<'gc>,
        mc: MutationContext<'gc, '_>,
    ) -> GcCell<'gc, Self> {
        let mut bottom_scope = None;
        let mut top_scope: Option<GcCell<'gc, Self>> = None;

        loop {
            let next_scope = GcCell::allocate(
                mc,
                Self {
                    parent: None,
                    class: parent.read().class,
                    values: parent.read().values,
                },
            );

            if parent.read().class == ScopeClass::Target {
                next_scope.write(mc).values = clip;
            }

            if bottom_scope.is_none() {
                bottom_scope = Some(next_scope);
            }

            if let Some(ref scope) = top_scope {
                scope.write(mc).parent = Some(next_scope);
            }

            top_scope = Some(next_scope);

            let grandparent = parent.read().parent;
            if let Some(grandparent) = grandparent {
                parent = grandparent;
            } else {
                break;
            }
        }

        bottom_scope.unwrap_or_else(|| {
            GcCell::allocate(
                mc,
                Self {
                    parent: None,
                    class: ScopeClass::Global,
                    values: ScriptObject::object_cell(mc, None),
                },
            )
        })
    }
/// Construct a scope for use with `tellTarget` code where the timeline
/// scope has been replaced with another given object.
Construct a scope for use with `tellTarget` code where the timeline
scope has been replaced with another given object.
Construct a scope for use with ` tellTarget ` code where the timeline scope has been replaced with another given object .
pub fn new_target_scope(
        mut parent: GcCell<'gc, Self>,
        clip: Object<'gc>,
        mc: MutationContext<'gc, '_>,
    ) -> GcCell<'gc, Self> {
        let mut bottom_scope = None;
        let mut top_scope: Option<GcCell<'gc, Self>> = None;
        loop {
            let next_scope = GcCell::allocate(
                mc,
                Self {
                    parent: None,
                    class: parent.read().class,
                    values: parent.read().values,
                },
            );
            if parent.read().class == ScopeClass::Target {
                next_scope.write(mc).values = clip;
            }
            if bottom_scope.is_none() {
                bottom_scope = Some(next_scope);
            }
            if let Some(ref scope) = top_scope {
                scope.write(mc).parent = Some(next_scope);
            }
            top_scope = Some(next_scope);
            let grandparent = parent.read().parent;
            if let Some(grandparent) = grandparent {
                parent = grandparent;
            } else {
                break;
            }
        }
        bottom_scope.unwrap_or_else(|| {
            GcCell::allocate(
                mc,
                Self {
                    parent: None,
                    class: ScopeClass::Global,
                    values: ScriptObject::object_cell(mc, None),
                },
            )
        })
    }
pub fn new_target_scope ( mut parent : GcCell < ' gc , Self > , clip : Object < ' gc > , mc : MutationContext < ' gc , ' _ > , ) -> GcCell < ' gc , Self > { let mut bottom_scope = None ; let mut top_scope : Option < GcCell < ' gc , Self > > = None ; loop { let next_scope = GcCell :: allocate ( mc , Self { parent : None , class : parent . read ( ) . class , values : parent . read ( ) . values , } , ) ; if parent . read ( ) . class == ScopeClass :: Target { next_scope . write ( mc ) . values = clip ; } if bottom_scope . is_none ( ) { bottom_scope = Some ( next_scope ) ; } if let Some ( ref scope ) = top_scope { scope . write ( mc ) . parent = Some ( next_scope ) ; } top_scope = Some ( next_scope ) ; let grandparent = parent . read ( ) . parent ; if let Some ( grandparent ) = grandparent { parent = grandparent ; } else { break ; } } bottom_scope . unwrap_or_else ( | | { GcCell :: allocate ( mc , Self { parent : None , class : ScopeClass :: Global , values : ScriptObject :: object_cell ( mc , None ) , } , ) } ) }
Construct a scope for use with `tellTarget` code where the timeline
scope has been replaced with another given object.
Construct a scope for use with ` tellTarget ` code where the timeline scope has been replaced with another given object .
parent
GcCell<'gc, Self>
clip
Object<'gc>
mc
MutationContext<'gc, '_>
parent
GcCell<'gc, Self>
clip
Object<'gc>
mc
MutationContext<'gc, '_>