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