royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yishay Weiss <yishayj...@hotmail.com>
Subject RE: MXML attributes, minification, and initialization
Date Tue, 05 Dec 2017 09:41:00 GMT
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.prototype.me}})



________________________________
From: Yishay Weiss <yishayjobs@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://github.com/yishayw/Examples/tree/release_bug

From: Alex Harui<mailto:aharui@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" <yishayjobs@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.
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message