Do not use lookahead when parsing imports in declare module in flow (#9987)
This commit is contained in:
parent
c2d303f8be
commit
5661de5908
@ -291,14 +291,13 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
let bodyNode = this.startNode();
|
||||
|
||||
if (this.match(tt._import)) {
|
||||
const lookahead = this.lookahead();
|
||||
if (lookahead.value !== "type" && lookahead.value !== "typeof") {
|
||||
this.next();
|
||||
if (!this.isContextual("type") && !this.isContextual("typeof")) {
|
||||
this.unexpected(
|
||||
null,
|
||||
this.state.lastTokStart,
|
||||
"Imports within a `declare module` body must always be `import type` or `import typeof`",
|
||||
);
|
||||
}
|
||||
this.next();
|
||||
this.parseImport(bodyNode);
|
||||
} else {
|
||||
this.expectContextual(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user