Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
package { public class Dummy { public static const NAME:String = "Dummy"; public function Dummy(myName:String=NAME) { _name = myName; } private var _name:String; } }
The constructor compiles to this:
/** * @constructor * @param {string=} myName */ Dummy = function(myName) { myName = typeof myName !== 'undefined' ? myName : NAME; this._name = myName; }; /** * @export * @const * @type {string} */ Dummy.NAME = "Dummy";
When trying to instantiate, you'll get an error NAME is undefined.
It should be this instead:
myName = typeof myName !== 'undefined' ? myName : Dummy.NAME;