greg-dove opened a new issue #115: Changes to static init have caused some 
regressions in js-release mode
URL: https://github.com/apache/royale-compiler/issues/115
 
 
   the change to 'accessor' implementations for static initializations has 
caused some issues with minified code no longer working (which did work 
previously).
   
   Example:
   ```
        public class BrokenStatics
        {
   
                public static var myStaticObject:Object = 
{'value':'myStaticObjInstance'};
   
                public static var myStaticArray:Array = new Array(20);
   
                public static var staticQName:QName = new QName('staticQName');
   
                public static var myStaticNamespace:Namespace = new 
Namespace('myStaticNamespace');
                
                public function BrokenStatics() {
                        COMPILE::JS{
                                //these work
                                console.log('BrokenStatics checking 
myStaticVar:' , myStaticObject );
                                console.log('BrokenStatics checking 
myStaticArray:' , myStaticArray );
                                //these don't work (they used to work)
                                console.log('BrokenStatics checking 
staticQName:' , staticQName );
                                console.log('BrokenStatics checking 
myStaticNamespace:' , myStaticNamespace );
                                //this will work:
                                console.log('BrokenStatics checking 
BrokenStatics[\'myStaticNamespace\']:' , BrokenStatics['myStaticNamespace'] );
                        }
                }
        }
   ```
   In the above class, the first two static inits do not have the accessor 
implementation applied in js-debug code and continue to work in release mode. 
The next two *do* have the accessor wrapping applied, but now the direct access 
to them does not work in minified code. (the value *is* available via the 
non-minified variable names, so BrokenStatics['myStaticNamespace'] will work 
for example)
   
   output of 'new BrokenStatics()' :
   ```
   BrokenStatics checking myStaticVar: {value: "myStaticObjInstance"}
   BrokenStatics checking myStaticArray: (20) [empty × 20]
   BrokenStatics checking staticQName: undefined
   BrokenStatics checking myStaticNamespace: undefined
   BrokenStatics checking BrokenStatics['myStaticNamespace']: Rp {Za: 
"myStaticNamespace", Eb: undefined}
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to