"super" allows to access a property in the class of the instance (inexistant in super classes)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Lightspark |
New
|
Undecided
|
Matthias Gehre |
Bug Description
The following code allows to access to the variable x with lightspark whereas no variable x exists in the super class of B1 (A1):
package{
import flash.display.
public class SuperTest extends Sprite{
public function SuperTest(){
var a = new B1();
}
}
}
class A1 { }
class B1 extends A1 {
var x = 1000
public function getSuperX(){
return super.x;
}
}
I think the problem could come from the method "getVariableByM
This code was compiled with the following command line (SuperTest.zip is attached and contains source and binary):
mxmlc -strict=false -debug -static-
A weird thing is that the code fails too with FP10 if the instance is a subclass of B1, defining:
class C1 extends B1{} // and replacing var a = new B1(); with var a = new C1();
Regarding the AVM2 specification the "getsuper" instruction use "obj" in the operand stack to determine the base class, it seems that, in fact, it uses the base class of the class containing the method definition ...
So is this a regression against FP10 or does this also fail on FP10?