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:05:58 UTC

[jira] [Assigned] (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 reassigned FLEX-35114:
---------------------------------

    Assignee: Alex Harui

> 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)