fix: disallow import assertionts in export without from (#12264)

This commit is contained in:
Huáng Jùnliàng
2020-10-28 02:07:20 -04:00
committed by GitHub
parent a8c66f4680
commit b7754d3c82
3 changed files with 15 additions and 5 deletions

View File

@@ -1906,6 +1906,10 @@ export default class StatementParser extends ExpressionParser {
if (this.eatContextual("from")) {
node.source = this.parseImportSource();
this.checkExport(node);
const assertions = this.maybeParseImportAssertions();
if (assertions) {
node.assertions = assertions;
}
} else {
if (expect) {
this.unexpected();
@@ -1914,11 +1918,6 @@ export default class StatementParser extends ExpressionParser {
}
}
const assertions = this.maybeParseImportAssertions();
if (assertions) {
node.assertions = assertions;
}
this.semicolon();
}