Also check AssignmentPatterns for export name (#9521)

This commit is contained in:
Daniel Tschinder
2019-02-15 22:55:03 -08:00
committed by GitHub
parent d1fe2d05f4
commit 058f057426
3 changed files with 11 additions and 3 deletions

View File

@@ -1816,7 +1816,9 @@ export default class StatementParser extends ExpressionParser {
}
checkDeclaration(node: N.Pattern | N.ObjectProperty): void {
if (node.type === "ObjectPattern") {
if (node.type === "Identifier") {
this.checkDuplicateExports(node, node.name);
} else if (node.type === "ObjectPattern") {
for (const prop of node.properties) {
this.checkDeclaration(prop);
}
@@ -1830,8 +1832,8 @@ export default class StatementParser extends ExpressionParser {
this.checkDeclaration(node.value);
} else if (node.type === "RestElement") {
this.checkDeclaration(node.argument);
} else if (node.type === "Identifier") {
this.checkDuplicateExports(node, node.name);
} else if (node.type === "AssignmentPattern") {
this.checkDeclaration(node.left);
}
}