Harbs created FLEX-35114:
----------------------------
Summary: static constants in constructor don't compile correctly
Key: FLEX-35114
URL: https://issues.apache.org/jira/browse/FLEX-35114
Project: Apache Flex
Issue Type: Bug
Components: FalconJX
Reporter: Harbs
{code:actionscript}
package
{
public class Dummy
{
public static const NAME:String = "Dummy";
public function Dummy(myName:String=NAME)
{
_name = myName;
}
private var _name:String;
}
}
{code}
The constructor compiles to this:
{code:javascript}
/**
* @constructor
* @param {string=} myName
*/
Dummy = function(myName) {
myName = typeof myName !== 'undefined' ? myName : NAME;
this._name = myName;
};
/**
* @export
* @const
* @type {string}
*/
Dummy.NAME = "Dummy";
{code}
When trying to instantiate, you'll get an error NAME is undefined.
It should be this instead:
{code:javascript}
myName = typeof myName !== 'undefined' ? myName : Dummy.NAME;
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)