changes based on review

This commit is contained in:
Erik Krogh Kristensen
2019-12-18 11:39:46 +01:00
parent 807664e545
commit 76d4db2552

View File

@@ -240,7 +240,7 @@ public class ESNextParser extends JSXParser {
if (this.type == TokenType._import) {
Position startLoc = this.startLoc;
this.next();
if (this.type == TokenType.dot) {
if (this.eat(TokenType.dot)) {
return parseImportMeta(startLoc);
}
this.expect(TokenType.parenL);
@@ -417,17 +417,16 @@ public class ESNextParser extends JSXParser {
}
/**
* Parses an import.meta expression, assuming that the initial "import" has been consumed.
* Parses an import.meta expression, assuming that the initial "import" and "." has been consumed.
*/
private MetaProperty parseImportMeta(Position loc) {
Identifier meta = new Identifier(new SourceLocation(loc), "import");
this.next();
Identifier importIdentifier = new Identifier(new SourceLocation(loc), "import");
Position propertyLoc = this.startLoc;
Identifier property = this.parseIdent(true);
if (!property.getName().equals("meta")) {
this.unexpected(propertyLoc);
}
return this.finishNode(new MetaProperty(new SourceLocation(loc), meta, property));
return this.finishNode(new MetaProperty(new SourceLocation(loc), importIdentifier, property));
}
/**