A bug when destructuring in a for .. of loop
Open
bug
- Dominant language
- JavaScript
- Stars
- 874
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
Minimal test case:
```js
{
let a;
}
for (const [a] of b) a();
```
Produces:
```js
{
var a;
}
for (var i = 0, list = b; i < list.length; i += 1) {
var ref = list[i];
var a = ref[0];
a$1();
}
```
Note that the `a$1` reference at the end is incorrect, since this symbol is not defined.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the minimal JavaScript test case in the issue and trace the compiler handling for-of loops with destructuring and shadowed bindings. Add a regression test for this example and verify that the generated code references a defined symbol rather than the incorrect a$1 reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100