google / google/closure-compiler
`@pureOrBreakMyCode` can't handle when left-hand side is array pattern
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
command `java -jar closure-compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --formatting PRETTY_PRINT --js input.js --js_output_file compiled.js`
the example code is trimmed from tc39 stage 3 decorator compiled by swc.
in the example,`@pureOrBreakMyCode` is added manually to `({ e: [_init_p3] } = /** @pureOrBreakMyCode */_apply_decs_2203_r(...)`
however, because left-hand side is destructuring assignment, so closure-compiler need to traverse the `lhs` and `valueNode` respectively, it can't eliminate the pure valueNode.

reproducible code
```
/** @noinline */
const applyDecs2203RFactory = () => { return () => {} }
/** @noinline */
const _apply_decs_2203_r = applyDecs2203RFactory()
var _init_p3;
class A {
constructor(){
this.p3 = /** @pureOrBreakMyCode */_init_p3(this, "3");
}
}
({ e: [_init_p3] } = /** @pureOrBreakMyCode */_apply_decs_2203_r(1, 2, 3));
```
Contributor guide
Assessment
This issue has not been assessed yet.