google / google/closure-compiler
Support transpiling for-loop initializer destructuring declarations w/ multiple children
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Originally reported as https://github.com/google/closure-compiler/issues/2832, filing a new bug since now we emit an error message instead of crashing.
We report a 'cannot transpile' error on code such as
``` javascript
for (let a = 0, {b} = {};;) { }
```
or
``` javascript
SOME_LABEL: let a = 0, {b} = {};
```
This happens inside [Es6SplitVariableDeclarations](https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/Es6SplitVariableDeclarations.java). It tries to split up declarations ike
``` javascript
let a = 0, {b} = {};
```
into
``` javascript
let a = 0;
let {b} = {};
```
to simplify a future pass that actually transpiles destructuring patterns. It cannot handle declarations that are not in statement blocks.
Contributor guide
Assessment
This issue has not been assessed yet.