apache / apache/royale-asjs

Crux broken in minified app

Open
#643 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
ActionScript
Stars
380
Forks
120
PR merge metrics
No merged PRs in 30d

Description

I traced the problem to here:
In CruxManager, there's the following code:
` public static var wiredViews:Map = new Map();`

That gets compiled to:

````
org.apache.royale.crux.CruxManager.get__wiredViews = function() {
var value = new Map();
Object.defineProperty(org.apache.royale.crux.CruxManager, 'wiredViews', { value: value, writable: true });
return value;
};
org.apache.royale.crux.CruxManager.set__wiredViews = function(value) {
Object.defineProperty(org.apache.royale.crux.CruxManager, 'wiredViews', { value: value, writable: true });
};
Object.defineProperties(org.apache.royale.crux.CruxManager, /** @lends {org.apache.royale.crux.CruxManager} */ {
/**
* @export
* @type {Map}
*/
wiredViews: {
get: org.apache.royale.crux.CruxManager.get__wiredViews,
set: org.apache.royale.crux.CruxManager.set__wiredViews,
configurable: true}});
````
In CruxManager.setup, there is the following code:
````
if (org.apache.royale.crux.CruxManager.wiredViews.get(view) != null)
return;
````
When minified, `org.apache.royale.crux.CruxManager.wiredViews` gets minified to a global variable (in my case `xn`) `xn` is undefined because the Map was defined in the getter which the global `xn` is not accessing.

I'm not sure when this change to static vars was done, but this seems wrong.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.