fix scope tracking for constants in loop heads - fixes #1229
This commit is contained in:
parent
1360c93e4b
commit
5326e0543d
@ -449,7 +449,7 @@ export default class Scope {
|
||||
if (path.isLoop()) {
|
||||
for (let i = 0; i < t.FOR_INIT_KEYS.length; i++) {
|
||||
var node = path.get(t.FOR_INIT_KEYS[i]);
|
||||
if (node.isBlockScoped()) this.registerBinding("let", node);
|
||||
if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
for (const i = 0; i < 3; i = i + 1) {
|
||||
console.log(i);
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Duplicate declaration \"i\""
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user