should only throw an error for colliding param bindings for let and const
This commit is contained in:
parent
d64c2c0c45
commit
e847f3685f
@ -106,12 +106,11 @@ var exportsVisitor = traverse.explode({
|
||||
|
||||
export default class DefaultFormatter {
|
||||
constructor(file) {
|
||||
|
||||
this.defaultIds = object();
|
||||
this.scope = file.scope;
|
||||
this.file = file;
|
||||
this.ids = object();
|
||||
this.internalRemap = object();
|
||||
this.defaultIds = object();
|
||||
this.scope = file.scope;
|
||||
this.file = file;
|
||||
this.ids = object();
|
||||
|
||||
this.hasNonDefaultExports = false;
|
||||
|
||||
|
||||
@ -240,7 +240,12 @@ export default class Scope {
|
||||
if (kind === "param") return;
|
||||
if (kind === "hoisted" && local.kind === "let") return;
|
||||
|
||||
if (local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param") {
|
||||
|
||||
var duplicate = false;
|
||||
duplicate ||= local.kind === "let" || local.kind === "const" || local.kind === "module";
|
||||
duplicate ||= local.kind === "param" && (kind === "let" || kind === "const");
|
||||
|
||||
if (duplicate) {
|
||||
throw this.file.errorWithNode(id, messages.get("scopeDuplicateDeclaration", name), TypeError);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user