You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Alex Harui (JIRA)" <ji...@apache.org> on 2016/11/15 18:06:58 UTC
[jira] [Resolved] (FLEX-35114) static constants in constructor
don't compile correctly
[ https://issues.apache.org/jira/browse/FLEX-35114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alex Harui resolved FLEX-35114.
-------------------------------
Resolution: Fixed
a3abbdb14f49b695c113e61de27d1dcc608de97c
> 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
> Assignee: Alex Harui
>
> {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)