rollup-plugin-closure-compiler icon indicating copy to clipboard operation
rollup-plugin-closure-compiler copied to clipboard

Convert Computed Static Keys to Static Keys

Open kristoferbaxter opened this issue 7 years ago • 0 comments

Is your feature request related to a problem? Please describe.

There are remaining computed keys that could be converted to static keys.

In this example (this[Qa] => this.Qa, b.propertyBackedAttributes_[c] => b.propertyBackedAttributes_.c, this[d] => this.d)

class w {
    constructor(a, b, c, d, e) {
      this[Qa] = [];
      this[13] = b;
      this[18] = c;
      this[46] = b[46].bind(b);
      b.propertyBackedAttributes_[c] = [() => this.value, a => (this.value = a)];
      d &&
        e &&
        Object.defineProperty(a.prototype, e, {
          enumerable: !0,
          configurable: !0,
          get() {
            return this[d].value;
          },
          set(a) {
            this[d].value = a;
          },
        });
    }
}

Describe the solution you'd like

Iterate over all Declarations and replace static computed keys with just the static key (as long as the key is a string, not a number this.11 is invalid.

kristoferbaxter avatar Nov 26 '18 20:11 kristoferbaxter