keywords are not allowed as local specifier (#307)
Also fix some error messages to be more specific
This commit is contained in:
@@ -1074,7 +1074,12 @@ pp.parseImportSpecifiers = function (node) {
|
||||
pp.parseImportSpecifier = function (node) {
|
||||
const specifier = this.startNode();
|
||||
specifier.imported = this.parseIdentifier(true);
|
||||
specifier.local = this.eatContextual("as") ? this.parseIdentifier() : specifier.imported.__clone();
|
||||
if (this.eatContextual("as")) {
|
||||
specifier.local = this.parseIdentifier();
|
||||
} else {
|
||||
this.checkReservedWord(specifier.imported.name, specifier.start, true, true);
|
||||
specifier.local = specifier.imported.__clone();
|
||||
}
|
||||
this.checkLVal(specifier.local, true, undefined, "import specifier");
|
||||
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user