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: [email protected]
