This the js output.


/**

* @export

* @type {boolean}

*/

components.MyComp.prototype.myProp = false;



________________________________
From: Alex Harui <aha...@adobe.com.INVALID>
Sent: Tuesday, December 5, 2017 7:31:54 PM
To: dev@royale.apache.org
Subject: Re: MXML attributes, minification, and initialization

It appears that the component in question is an MXML component, as opposed
to an AS component.  In our AS Components, a public var, like the name
property in HTTPHeader.as is output in HTTPHeader.js as:

  /**
  * @export
  * @type {string}
  */
  org.apache.royale.net.HTTPHeader.prototype.name;

Supposedly, the @export will prevent the name property from being renamed
by GCC.


If you look at your MXML component's .js output, does it have @export in
the JSDoc for myProp?  I'm guessing it doesn't and that is the bug.  The
compiler has to do some interesting things to output fx:Script blocks.

Thanks,
-Alex


On 12/5/17, 1:41 AM, "Yishay Weiss" <yishayj...@hotmail.com> wrote:

>When I change MyComp to have get/set the result is the following added
>line, which probably protects the public interface.
>
>
>
>Object.defineProperties(wf.prototype,{myProp:{get:wf.prototype.ad,set:wf.p
>rototype.me}})
>
>
>
>________________________________
>From: Yishay Weiss <yishayj...@hotmail.com>
>Sent: Tuesday, December 5, 2017 11:00:40 AM
>To: dev@royale.apache.org
>Subject: RE: MXML attributes, minification, and initialization
>
>In this [1] I get the following in debug:
>
>[org.apache.royale.core.View, 1, '_id', true, '$ID1', 0, 0,
>[components.MyComp, 2, 'id', true, 'myComp', 'myProp', true
>And
>this.myLabel.text = "myProp: " + this.myComp.myProp;
>
>And this in release:
>
>
>[W,1,'_id',!0,'$ID1',0,0,[wf,2,'id',!0,'myComp','myProp',!0,
>And
>
>this.myLabel.text='myProp: '+this.myComp.cc
>
>
>So it looks like myComp.myProp is renamed to myComp.cc when reading, but
>not when writing.
>
>If I change the code from
>
>                                public var myProp:Boolean = false;
>to
>
>                                public var myProp:Boolean;
>
>Then I get in release
>
>
>this.myLabel.text='myProp: '+this.myComp.myProp
>
>Which has correct behavior.
>
>[1]
>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.co
>m%2Fyishayw%2FExamples%2Ftree%2Frelease_bug&data=02%7C01%7Caharui%40adobe.
>com%7C07c1ce89c6e648015f0e08d53bc45175%7Cfa7b1b5a7b34438794aed2c178decee1%
>7C0%7C0%7C636480636727412967&sdata=yfqv4ORwJio8TJJLzFUSFcCbSWGNJHTQMQb9gT9
>LJ9o%3D&reserved=0
>
>From: Alex Harui<mailto:aha...@adobe.com.INVALID>
>Sent: Monday, December 4, 2017 7:14 PM
>To: dev@royale.apache.org<mailto:dev@royale.apache.org>
>Subject: Re: MXML attributes, minification, and initialization
>
>Interesting.
>
>What is the generated data structure for that property?  How does the
>generated data structure differ if the property is getter/setter?
>
>Thanks,
>-Alex
>
>On 12/4/17, 3:30 AM, "Yishay Weiss" <yishayj...@hotmail.com> wrote:
>
>>We ran into an interesting problem with minification. If you have a
>>component with an attribute that’s initialized like this:
>>
>>public var myProp:Boolean = false;
>>
>>and you try to initialize it from mxml (<comp myProp=”true”/>) the result
>>will be myComp == true in debug and myComp == false in release.
>>
>>We found 2 ways around that: either don’t initialize (public var
>>myProp:Boolean) or use get/set methods instead.
>>
>>I’m not sure what’s going on there but it’s something to watch out for.
>>
>

Reply via email to