Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Apache FlexJS 0.5.0
-
None
Description
const class members should be initialized the same way that var members get initialized. As it is now, const member variables are initialized as if they were static.
Example code:
public class TestClass { public function TestClass(value:String) { myConst.prop = value; myVar.prop = value; } public const myConst:Object = {}; public var myVar:Object = {}; }
Incorrectly cross-compiled:
TestClass = function(value) { this.myVar = {}; this.myConst.prop = value; this.myVar.prop = value; }; TestClass.prototype.myConst = {}; TestClass.prototype.myVar;
Expected correct result:
TestClass = function(value) { this.myConst = {}; this.myVar = {}; this.myConst.prop = value; this.myVar.prop = value; }; TestClass.prototype.myConst; TestClass.prototype.myVar;