Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-34986

const class member variables get initialized incorrectly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Apache FlexJS 0.5.0
    • Apache FalconJX 0.6.0
    • Falcon, FlexJS
    • 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;
      

      Attachments

        Activity

          People

            aharui Alex Harui
            adufilie Andy Dufilie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: