You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/09/15 11:26:23 UTC

[GitHub] [royale-compiler] Harbs opened a new issue #159: Minification issue

Harbs opened a new issue #159:
URL: https://github.com/apache/royale-compiler/issues/159


   1. Go to: https://unhurdle.github.io/spectrum-royale/ you'll see the page is blank. You should get the contents of https://unhurdle.github.io/spectrum-royale/#!accordion
   2. That is handled in https://github.com/unhurdle/spectrum-royale/blob/master/SpectrumBrowser/src/view/BrowserRouter.mxml#L26 where the default route is specified.
   3. The source of RouteToComponent is cross-compiled to:
   ````
   /**
    * Generated by Apache Royale Compiler from org/apache/royale/routing/RouteToComponent.as
    * org.apache.royale.routing.RouteToComponent
    *
    * @fileoverview
    *
    * @suppress {missingRequire|checkTypes|accessControls}
    */
   
   goog.provide('org.apache.royale.routing.RouteToComponent');
   /* Royale Dependency List: org.apache.royale.core.IChild,org.apache.royale.core.IParent,org.apache.royale.core.IStrand,org.apache.royale.routing.ComponentRoute,org.apache.royale.utils.Language*/
   
   goog.require('org.apache.royale.routing.PathRouteBead');
   
   
   
   /**
    * @constructor
    * @extends {org.apache.royale.routing.PathRouteBead}
    */
   org.apache.royale.routing.RouteToComponent = function() {
     org.apache.royale.routing.RouteToComponent.base(this, 'constructor');
   };
   goog.inherits(org.apache.royale.routing.RouteToComponent, org.apache.royale.routing.PathRouteBead);
   
   
   /**
    * @type {Array}
    */
   org.apache.royale.routing.RouteToComponent.prototype.routes;
   
   
   /**
    * @royaleignorecoercion org.apache.royale.core.IParent
    * @private
    */
   org.apache.royale.routing.RouteToComponent.prototype.org_apache_royale_routing_RouteToComponent_stateChanged = function() {
     var /** @type {org.apache.royale.routing.ComponentRoute} */ defaultRoute;
     if (this.routes) {
       var /** @type {string} */ baseName = this.host.routeState.getBaseName();
       for (var /** @type {number} */ i = 0; i < this.routes.length; i++) {
         var /** @type {org.apache.royale.routing.ComponentRoute} */ route = this.routes[i];
         if (route.defaultRoute)
           defaultRoute = route;
         if (route.baseName == baseName) {
           this.org_apache_royale_routing_RouteToComponent_addComponent(route);
           return;
         }
       }
       if (defaultRoute) {
         this.org_apache_royale_routing_RouteToComponent_addComponent(defaultRoute);
       }
     }
   };
   
   
   /**
    * @private
    * @param {org.apache.royale.routing.ComponentRoute} route
    */
   org.apache.royale.routing.RouteToComponent.prototype.org_apache_royale_routing_RouteToComponent_addComponent = function(route) {
     var /** @type {org.apache.royale.core.IParent} */ parent = route.parent || org.apache.royale.utils.Language.as(this.host.host, org.apache.royale.core.IParent);
     while (parent.numElements > 0)
       parent.removeElement(parent.getElementAt(0));
     var /** @type {org.apache.royale.core.IChild} */ comp = new route.component();
     parent.addElement(comp);
     if (route.title)
       this.host.routeState.title = route.title;
   };
   
   
   org.apache.royale.routing.RouteToComponent.prototype.set__strand = function(value) {
     org.apache.royale.routing.RouteToComponent.superClass_.set__strand.apply(this, [ value] );
     this.listenOnStrand("stateChange", org.apache.royale.utils.Language.closure(this.org_apache_royale_routing_RouteToComponent_stateChanged, this, 'org_apache_royale_routing_RouteToComponent_stateChanged'));
   };
   
   
   Object.defineProperties(org.apache.royale.routing.RouteToComponent.prototype, /** @lends {org.apache.royale.routing.RouteToComponent.prototype} */ {
   /**
     * @export
     * @type {org.apache.royale.core.IStrand} */
   strand: {
   set: org.apache.royale.routing.RouteToComponent.prototype.set__strand}}
   );
   
   
   /**
    * Metadata
    *
    * @type {Object.<string, Array.<Object>>}
    */
   org.apache.royale.routing.RouteToComponent.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'RouteToComponent', qName: 'org.apache.royale.routing.RouteToComponent', kind: 'class' }] };
   
   
   
   /**
    * Reflection
    *
    * @return {Object.<string, Function>}
    */
   org.apache.royale.routing.RouteToComponent.prototype.ROYALE_REFLECTION_INFO = function () {
     return {
       variables: function () {
         return {
           'routes': { type: 'Array', get_set: function (/** org.apache.royale.routing.RouteToComponent */ inst, /** * */ v) {return v !== undefined ? inst.routes = v : inst.routes;}}
         };
       },
       accessors: function () {
         return {
           'strand': { type: 'org.apache.royale.core.IStrand', access: 'writeonly', declaredBy: 'org.apache.royale.routing.RouteToComponent'}
         };
       },
       methods: function () {
         return {
           'RouteToComponent': { type: '', declaredBy: 'org.apache.royale.routing.RouteToComponent'}
         };
       }
     };
   };
   /**
    * @const
    * @type {number}
    */
   org.apache.royale.routing.RouteToComponent.prototype.ROYALE_COMPILE_FLAGS = 10;
   ````
   4. The above code is minified to:
   ````function QR() {}
   E(QR, PR);
   D(zC, QR);
   QR.prototype.XH = function() {
       if (this.routes)
           for (var a = this.host.routeState.getBaseName(), d = 0; d < this.routes.length; d++) {
               var f = this.routes[d];
               if (f.baseName == a) {
                   a = f;
                   for (d = a.parent || F.as(this.host.host, lK); 0 < d.numElements; )
                       d.removeElement(d.getElementAt(0));
                   f = new a.component;
                   d.addElement(f);
                   a.title && (this.host.routeState.title = a.title);
                   break
               }
           }
   }
   ;
   QR.prototype.u = function(a) {
       QR.l.u.apply(this, [a]);
       this.listenOnStrand(yF, F.j(this.XH, this, 'org_apache_royale_routing_RouteToComponent_stateChanged'))
   }
   ;
   Object.defineProperties(QR.prototype, {
       strand: {
           set: QR.prototype.u
       }
   });
   QR.prototype.g = {
       names: [{
           name: 'RouteToComponent',
           i: zC,
           kind: c
       }]
   };
   ````
   
   I'm not 100% sure what's going on, but some things worth noting:
   
   1. `addComponent` is completely inlined.
   2. `f.baseName` is used even though the property is optimized out of the class.
   3. It looks like `defaultRoute` logic in the method is somehow optimized out.
   
   The `ComponentRoute` class is minimized into this:
   ```
   function NS() {}
   D(sC, NS);
   NS.prototype.defaultRoute = !1;
   D('org.apache.royale.routing.ComponentRoute.prototype.defaultRoute', NS.prototype.defaultRoute);
   NS.prototype.g = {
       names: [{
           name: 'ComponentRoute',
           i: sC,
           kind: c
       }]
   };


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-compiler] Harbs edited a comment on issue #159: Minification issue

Posted by GitBox <gi...@apache.org>.
Harbs edited a comment on issue #159:
URL: https://github.com/apache/royale-compiler/issues/159#issuecomment-692654639


   For reference, here's the cross-compiled `ComponentRoute` class before minification:
   ````
   /**
    * Generated by Apache Royale Compiler from org/apache/royale/routing/ComponentRoute.as
    * org.apache.royale.routing.ComponentRoute
    *
    * @fileoverview
    *
    * @suppress {missingRequire|checkTypes|accessControls}
    */
   
   goog.provide('org.apache.royale.routing.ComponentRoute');
   /* Royale Dependency List: org.apache.royale.core.IParent*/
   
   
   
   
   /**
    * @constructor
    */
   org.apache.royale.routing.ComponentRoute = function() {
   };
   
   
   /**
    * @type {Object}
    */
   org.apache.royale.routing.ComponentRoute.prototype.component;
   
   
   /**
    * @type {string}
    */
   org.apache.royale.routing.ComponentRoute.prototype.baseName;
   
   
   /**
    * @type {org.apache.royale.core.IParent}
    */
   org.apache.royale.routing.ComponentRoute.prototype.parent;
   
   
   /**
    * @type {string}
    */
   org.apache.royale.routing.ComponentRoute.prototype.title;
   
   
   /**
    * @type {boolean}
    */
   org.apache.royale.routing.ComponentRoute.prototype.defaultRoute = false;
   
   
   /**
    * Metadata
    *
    * @type {Object.<string, Array.<Object>>}
    */
   org.apache.royale.routing.ComponentRoute.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'ComponentRoute', qName: 'org.apache.royale.routing.ComponentRoute', kind: 'class' }] };
   
   
   
   /**
    * Reflection
    *
    * @return {Object.<string, Function>}
    */
   org.apache.royale.routing.ComponentRoute.prototype.ROYALE_REFLECTION_INFO = function () {
     return {
       variables: function () {
         return {
           'component': { type: 'Class', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.component = v : inst.component;}},
           'baseName': { type: 'String', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.baseName = v : inst.baseName;}},
           'parent': { type: 'org.apache.royale.core.IParent', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.parent = v : inst.parent;}},
           'title': { type: 'String', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.title = v : inst.title;}},
           'defaultRoute': { type: 'Boolean', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.defaultRoute = v : inst.defaultRoute;}}
         };
       },
       methods: function () {
         return {
           'ComponentRoute': { type: '', declaredBy: 'org.apache.royale.routing.ComponentRoute'}
         };
       }
     };
   };
   /**
    * @const
    * @type {number}
    */
   org.apache.royale.routing.ComponentRoute.prototype.ROYALE_COMPILE_FLAGS = 10;
   ````


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-compiler] Harbs commented on issue #159: Minification issue

Posted by GitBox <gi...@apache.org>.
Harbs commented on issue #159:
URL: https://github.com/apache/royale-compiler/issues/159#issuecomment-693636138


   Thanks. I can confirm that the changes fixed it.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-compiler] asfgit closed issue #159: Minification issue

Posted by GitBox <gi...@apache.org>.
asfgit closed issue #159:
URL: https://github.com/apache/royale-compiler/issues/159


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-compiler] joshtynjala commented on issue #159: Minification issue

Posted by GitBox <gi...@apache.org>.
joshtynjala commented on issue #159:
URL: https://github.com/apache/royale-compiler/issues/159#issuecomment-693589401


   I was able to do a partial revert of some of my recent changes, and that got SpectrumBrowser working correctly. However, the issue that Carlos encountered was not fixed, so I guess that they are different after all.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-compiler] Harbs commented on issue #159: Minification issue

Posted by GitBox <gi...@apache.org>.
Harbs commented on issue #159:
URL: https://github.com/apache/royale-compiler/issues/159#issuecomment-692654639


   For reference, here's the cross-compiler ComponentRoute class before minification:
   ````
   /**
    * Generated by Apache Royale Compiler from org/apache/royale/routing/ComponentRoute.as
    * org.apache.royale.routing.ComponentRoute
    *
    * @fileoverview
    *
    * @suppress {missingRequire|checkTypes|accessControls}
    */
   
   goog.provide('org.apache.royale.routing.ComponentRoute');
   /* Royale Dependency List: org.apache.royale.core.IParent*/
   
   
   
   
   /**
    * @constructor
    */
   org.apache.royale.routing.ComponentRoute = function() {
   };
   
   
   /**
    * @type {Object}
    */
   org.apache.royale.routing.ComponentRoute.prototype.component;
   
   
   /**
    * @type {string}
    */
   org.apache.royale.routing.ComponentRoute.prototype.baseName;
   
   
   /**
    * @type {org.apache.royale.core.IParent}
    */
   org.apache.royale.routing.ComponentRoute.prototype.parent;
   
   
   /**
    * @type {string}
    */
   org.apache.royale.routing.ComponentRoute.prototype.title;
   
   
   /**
    * @type {boolean}
    */
   org.apache.royale.routing.ComponentRoute.prototype.defaultRoute = false;
   
   
   /**
    * Metadata
    *
    * @type {Object.<string, Array.<Object>>}
    */
   org.apache.royale.routing.ComponentRoute.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'ComponentRoute', qName: 'org.apache.royale.routing.ComponentRoute', kind: 'class' }] };
   
   
   
   /**
    * Reflection
    *
    * @return {Object.<string, Function>}
    */
   org.apache.royale.routing.ComponentRoute.prototype.ROYALE_REFLECTION_INFO = function () {
     return {
       variables: function () {
         return {
           'component': { type: 'Class', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.component = v : inst.component;}},
           'baseName': { type: 'String', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.baseName = v : inst.baseName;}},
           'parent': { type: 'org.apache.royale.core.IParent', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.parent = v : inst.parent;}},
           'title': { type: 'String', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.title = v : inst.title;}},
           'defaultRoute': { type: 'Boolean', get_set: function (/** org.apache.royale.routing.ComponentRoute */ inst, /** * */ v) {return v !== undefined ? inst.defaultRoute = v : inst.defaultRoute;}}
         };
       },
       methods: function () {
         return {
           'ComponentRoute': { type: '', declaredBy: 'org.apache.royale.routing.ComponentRoute'}
         };
       }
     };
   };
   /**
    * @const
    * @type {number}
    */
   org.apache.royale.routing.ComponentRoute.prototype.ROYALE_COMPILE_FLAGS = 10;
   ````


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-compiler] joshtynjala commented on issue #159: Minification issue

Posted by GitBox <gi...@apache.org>.
joshtynjala commented on issue #159:
URL: https://github.com/apache/royale-compiler/issues/159#issuecomment-692816385


   I suspect that this is the same issue that Carlos is encountering here:
   
   https://lists.apache.org/thread.html/rd2618a0caefdab530cbdabf0c21a201c2512e8a36a974f7e0ba2c1cd%40%3Cdev.royale.apache.org%3E
   
   I am investigating.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-compiler] Harbs commented on issue #159: Minification issue

Posted by GitBox <gi...@apache.org>.
Harbs commented on issue #159:
URL: https://github.com/apache/royale-compiler/issues/159#issuecomment-692835427


   Yes. I suspect so. I hope the additional case/info is helpful.


----------------------------------------------------------------
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:
users@infra.apache.org