ampproject / ampproject/rollup-plugin-closure-compiler

Convert Computed Static Keys to Static Keys

Open
#118 0 comments 0 reactions 1 assignee Claimed by @kristoferbaxter View on GitHub
enhancement
Dominant language
TypeScript
Stars
293
Forks
28
PR merge metrics
No merged PRs in 30d

Description

## 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`)
```javascript
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.