Fix regression with let (#9477)

* Fix corner cases with let

* Handle generators correctly

* Fix flow plugin

* Fix typescript plugin
This commit is contained in:
Daniel Tschinder
2019-02-08 13:36:37 -08:00
committed by GitHub
parent 7943a48cc3
commit 2817844e89
20 changed files with 728 additions and 242 deletions

View File

@@ -1566,7 +1566,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
}
// interfaces
parseStatement(declaration: boolean, topLevel?: boolean): N.Statement {
parseStatement(context: ?string, topLevel?: boolean): N.Statement {
// strict mode handling of `interface` since it's a reserved word
if (
this.state.strict &&
@@ -1577,7 +1577,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.next();
return this.flowParseInterface(node);
} else {
const stmt = super.parseStatement(declaration, topLevel);
const stmt = super.parseStatement(context, topLevel);
// We will parse a flow pragma in any comment before the first statement.
if (this.flowPragma === undefined && !this.isValidDirective(stmt)) {
this.flowPragma = null;

View File

@@ -1699,10 +1699,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return super.parseExportDefaultExpression();
}
parseStatementContent(
declaration: boolean,
topLevel: ?boolean,
): N.Statement {
parseStatementContent(context: ?string, topLevel: ?boolean): N.Statement {
if (this.state.type === tt._const) {
const ahead = this.lookahead();
if (ahead.type === tt.name && ahead.value === "enum") {
@@ -1712,7 +1709,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return this.tsParseEnumDeclaration(node, /* isConst */ true);
}
}
return super.parseStatementContent(declaration, topLevel);
return super.parseStatementContent(context, topLevel);
}
parseAccessModifier(): ?N.Accessibility {