google / google/closure-compiler
ES6 transpilation of spread causes CollapseProperties to back off in some cases
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
For instance, if you have an array of numbers and you call `goog.math.average(...nums)` this translates to (roughly) `goog.math.average.apply(goog.math, nums)` because the ES6 transpilation pass doesn't know that goog.math.average doesn't care what its `this` value is, so it doesn't know that `goog.math.average.apply(null, nums)` would have worked just as well. Then we get a warning "incomplete alias created for namespace goog.math" and CollapseProperties fails to collapse that namespace as well as it otherwise would have.
Maybe we write a pass that goes through after transpilation and replaces the `goog.math` with `null` when we know that can be done safely.
Contributor guide
Assessment
This issue has not been assessed yet.