fix scope tracking for constants in loop heads - fixes #1229
This commit is contained in:
@@ -449,7 +449,7 @@ export default class Scope {
|
|||||||
if (path.isLoop()) {
|
if (path.isLoop()) {
|
||||||
for (let i = 0; i < t.FOR_INIT_KEYS.length; i++) {
|
for (let i = 0; i < t.FOR_INIT_KEYS.length; i++) {
|
||||||
var node = path.get(t.FOR_INIT_KEYS[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\""
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user