avm1: The this property should be mutable
This commit is contained in:
parent
4149913967
commit
f7b0c021a9
|
@ -185,16 +185,9 @@ pub struct Activation<'a, 'gc: 'a> {
|
|||
/// The currently in use constant pool.
|
||||
constant_pool: Gc<'gc, Vec<Value<'gc>>>,
|
||||
|
||||
/// The immutable value of `this`.
|
||||
/// The value of `this`.
|
||||
///
|
||||
/// This differs from Flash Player, where `this` is mutable and seems
|
||||
/// to be part of the scope chain (e.g. a function with the `suppress_this` flag
|
||||
/// set can modify the `this` value of its closure).
|
||||
///
|
||||
/// Fortunately, ActionScript syntax prevents mutating `this` altogether, so
|
||||
/// observing this behavior requires manually-crafted bytecode.
|
||||
///
|
||||
/// TODO: implement correct semantics for mutable `this`.
|
||||
/// While this is not *usually* modified, ActionScript does allow `this` to be modified
|
||||
this: Value<'gc>,
|
||||
|
||||
/// The function object being called.
|
||||
|
@ -2637,6 +2630,12 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
// Special case, mutating `this`
|
||||
if path.as_wstr() == WStr::from_units(b"this") {
|
||||
self.this = value;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Find the right-most : or . in the path.
|
||||
// If we have one, we must resolve as a target path.
|
||||
let separator = path.rfind(b":.".as_ref());
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
this = _level0
|
||||
typeof this = movieclip
|
||||
this = test
|
||||
typeof this = string
|
||||
In foo
|
||||
this = _level0
|
||||
typeof this = movieclip
|
||||
this = 1234
|
||||
typeof this = number
|
||||
In nested
|
||||
this = _level0
|
||||
typeof this = movieclip
|
||||
this = null
|
||||
typeof this = null
|
||||
Exit nested
|
||||
this = 1234
|
||||
typeof this = number
|
||||
Exit foo
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
num_frames = 1
|
Loading…
Reference in New Issue