google / google/closure-compiler
Poor constant propagation through destructuring assignments
Open
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Google closure struggles with constant propagation through destructing assignments, which, unfortunately happens very frequently in modern js code.
```javascript filename:a.js
const { A: a, B: b } = { A: 1, B: 2 }
console.log(a, b);
```
`google-closure-compiler --js a.js -O ADVANCED` outputs
```javascript
const {g:a,h:b}={g:1,h:2};console.log(a,b);
```
Many function call happen through "object pattern" parameters in modern js and google closure does no constant propagation through them nor does it have "re-write to normal params" kind of pass.
Contributor guide
Assessment
This issue has not been assessed yet.