move var scope collector to before block - fixes #1153
This commit is contained in:
parent
56335409d3
commit
7c710a0378
@ -240,7 +240,6 @@ export default class Scope {
|
||||
if (kind === "param") return;
|
||||
if (kind === "hoisted" && local.kind === "let") return;
|
||||
|
||||
|
||||
var duplicate = false;
|
||||
duplicate ||= local.kind === "let" || local.kind === "const" || local.kind === "module";
|
||||
duplicate ||= local.kind === "param" && (kind === "let" || kind === "const");
|
||||
@ -477,6 +476,15 @@ export default class Scope {
|
||||
this.traverse(path.get("body").node, blockVariableVisitor, this);
|
||||
}
|
||||
|
||||
// Program, Function - var variables
|
||||
|
||||
if (path.isProgram() || path.isFunction()) {
|
||||
this.traverse(path.node, functionVariableVisitor, {
|
||||
blockId: path.get("id").node,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
// Program, BlockStatement, Function - let variables
|
||||
|
||||
if (path.isBlockStatement() || path.isProgram()) {
|
||||
@ -495,15 +503,6 @@ export default class Scope {
|
||||
this.registerBinding("let", path);
|
||||
}
|
||||
|
||||
// Program, Function - var variables
|
||||
|
||||
if (path.isProgram() || path.isFunction()) {
|
||||
this.traverse(path.node, functionVariableVisitor, {
|
||||
blockId: path.get("id").node,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
// Program
|
||||
|
||||
if (path.isProgram()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user