Add support for Flow shorthand import type (#267)
This commit is contained in:
committed by
Daniel Tschinder
parent
68bb1c6598
commit
9ea4e9dead
@@ -1061,14 +1061,18 @@ pp.parseImportSpecifiers = function (node) {
|
||||
if (this.eat(tt.braceR)) break;
|
||||
}
|
||||
|
||||
let specifier = this.startNode();
|
||||
specifier.imported = this.parseIdentifier(true);
|
||||
specifier.local = this.eatContextual("as") ? this.parseIdentifier() : specifier.imported.__clone();
|
||||
this.checkLVal(specifier.local, true, undefined, "import specifier");
|
||||
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
|
||||
this.parseImportSpecifier(node);
|
||||
}
|
||||
};
|
||||
|
||||
pp.parseImportSpecifier = function (node) {
|
||||
let specifier = this.startNode();
|
||||
specifier.imported = this.parseIdentifier(true);
|
||||
specifier.local = this.eatContextual("as") ? this.parseIdentifier() : specifier.imported.__clone();
|
||||
this.checkLVal(specifier.local, true, undefined, "import specifier");
|
||||
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
|
||||
};
|
||||
|
||||
pp.parseImportSpecifierDefault = function (id, startPos, startLoc) {
|
||||
let node = this.startNodeAt(startPos, startLoc);
|
||||
node.local = id;
|
||||
|
||||
Reference in New Issue
Block a user