Use the same methodology to construct new scopes for tellTarget.
This commit is contained in:
parent
1b62ead082
commit
b4ddd323f2
|
@ -121,20 +121,33 @@ impl<'gc> Scope<'gc> {
|
||||||
clip: GcCell<'gc, Object<'gc>>,
|
clip: GcCell<'gc, Object<'gc>>,
|
||||||
mc: MutationContext<'gc, '_>,
|
mc: MutationContext<'gc, '_>,
|
||||||
) -> GcCell<'gc, Self> {
|
) -> GcCell<'gc, Self> {
|
||||||
let mut timeline_scope_list = Vec::new();
|
let mut bottom_scope = None;
|
||||||
|
let mut top_scope: Option<GcCell<'gc, Self>> = None;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if parent.read().class != ScopeClass::Target {
|
let next_scope = GcCell::allocate(
|
||||||
timeline_scope_list.push(parent);
|
mc,
|
||||||
} else {
|
Self {
|
||||||
let new_scope = Self {
|
|
||||||
parent: None,
|
parent: None,
|
||||||
class: ScopeClass::Target,
|
class: parent.read().class,
|
||||||
values: clip,
|
values: parent.read().values,
|
||||||
};
|
},
|
||||||
timeline_scope_list.push(GcCell::allocate(mc, new_scope));
|
);
|
||||||
|
|
||||||
|
if parent.read().class == ScopeClass::Target {
|
||||||
|
next_scope.write(mc).values = clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let None = bottom_scope {
|
||||||
|
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;
|
let grandparent = parent.read().parent;
|
||||||
if let Some(grandparent) = grandparent {
|
if let Some(grandparent) = grandparent {
|
||||||
parent = grandparent;
|
parent = grandparent;
|
||||||
|
@ -143,30 +156,16 @@ impl<'gc> Scope<'gc> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut parent_scope = None;
|
bottom_scope.unwrap_or_else(|| {
|
||||||
for scope in timeline_scope_list.iter().rev() {
|
|
||||||
parent_scope = Some(GcCell::allocate(
|
|
||||||
mc,
|
|
||||||
Scope {
|
|
||||||
parent: parent_scope,
|
|
||||||
class: scope.read().class,
|
|
||||||
values: scope.read().values,
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(parent_scope) = parent_scope {
|
|
||||||
parent_scope
|
|
||||||
} else {
|
|
||||||
GcCell::allocate(
|
GcCell::allocate(
|
||||||
mc,
|
mc,
|
||||||
Scope {
|
Self {
|
||||||
parent: None,
|
parent: None,
|
||||||
class: ScopeClass::Global,
|
class: ScopeClass::Global,
|
||||||
values: GcCell::allocate(mc, Object::bare_object()),
|
values: GcCell::allocate(mc, Object::bare_object()),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construct a with scope to be used as the scope during a with block.
|
/// Construct a with scope to be used as the scope during a with block.
|
||||||
|
|
Loading…
Reference in New Issue