flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harbs (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEX-35114) static constants in constructor don't compile correctly
Date Sun, 17 Jul 2016 12:10:20 GMT
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)

Mime
View raw message