diff --git a/core/src/avm2/object/class_object.rs b/core/src/avm2/object/class_object.rs index 6fa403b39..dfcb68460 100644 --- a/core/src/avm2/object/class_object.rs +++ b/core/src/avm2/object/class_object.rs @@ -544,7 +544,7 @@ impl<'gc> ClassObject<'gc> { // todo: handle errors let (superclass_object, method) = self.instance_vtable().get_full_method(disp_id).unwrap(); - let scope = superclass_object.unwrap().class_scope(); + let scope = superclass_object.unwrap().instance_scope(); let callee = FunctionObject::from_method( activation, method.clone(), diff --git a/tests/tests/swfs/avm2/issue_5292/Test.as b/tests/tests/swfs/avm2/issue_5292/Test.as index 81fc21db9..11045f5b7 100644 --- a/tests/tests/swfs/avm2/issue_5292/Test.as +++ b/tests/tests/swfs/avm2/issue_5292/Test.as @@ -1,14 +1,34 @@ -package +package { - public class Test + public class Test { + public function Test() { + new Subclass(); + } + } +} + class BaseClass { public static var t = "static prop"; - public function Test() + public function instance_method() { - trace("// Getting static property"); + trace("// Getting static property in instance method"); trace(t); } - + } -} + + class Subclass extends BaseClass + { + public function Subclass() + { + trace("// Getting static property in subclass constructor"); + trace(t); + instance_method(); + } + + public override function instance_method() { + trace("Calling super!"); + super.instance_method(); + } + } \ No newline at end of file diff --git a/tests/tests/swfs/avm2/issue_5292/output.txt b/tests/tests/swfs/avm2/issue_5292/output.txt index 46d295e98..8c7ffbeed 100644 --- a/tests/tests/swfs/avm2/issue_5292/output.txt +++ b/tests/tests/swfs/avm2/issue_5292/output.txt @@ -1,2 +1,5 @@ -// Getting static property -static prop \ No newline at end of file +// Getting static property in subclass constructor +static prop +Calling super! +// Getting static property in instance method +static prop diff --git a/tests/tests/swfs/avm2/issue_5292/test.swf b/tests/tests/swfs/avm2/issue_5292/test.swf index 3feabceed..527ef1d89 100644 Binary files a/tests/tests/swfs/avm2/issue_5292/test.swf and b/tests/tests/swfs/avm2/issue_5292/test.swf differ