On 10/5/16, 10:43 AM, "Harbs" <[email protected]> wrote:
>I have not been following this discussion very well, so I’m not sure I
>got the issue, but will this prevent optimization of minimized code which
>accesses static properties?
I think I have discovered that static getters/setters were never getting
renamed anyway. That's because if you have:
public class Foo {
public static function get bar():String
It becomes:
Object.defineProperty(Foo, { bar : function ... }
And thus "bar" is a key in an Object and GCC doesn't try to rename those.
Josh tried using @expose, which also prevented renaming as well, but we
want to avoid using deprecated jsdoc tags.
So, I think the final minified code in js-release is the same whether we
are using @expose or this proposed change, but if you work with the
js-debug code you will see:
Foo["bar"]
instead of
Foo.bar
FWIW, with just plain @export, the problem is that when setting up the
renamed list for a class, GCC seems to only look at the code that looks
like:
/**
* @type {string}
*/
Foo.someOtherStaticProperty;
and doesn't understand the Object.defineProperty call, so it doesn't think
there is a "bar" property on Foo at all. So then, it optimizes
Foo.bar
to just a global like:
xx
HTH,
-Alex