Allow function types in type params within arrow return types (#8954)

This commit is contained in:
Daniel Tschinder
2018-11-01 07:10:46 -07:00
committed by Brian Ng
parent e85faec47d
commit cd81b079ee
5 changed files with 439 additions and 0 deletions

View File

@@ -638,12 +638,15 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.state.inType = true;
this.expectRelational("<");
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
this.state.noAnonFunctionType = false;
while (!this.isRelational(">")) {
node.params.push(this.flowParseType());
if (!this.isRelational(">")) {
this.expect(tt.comma);
}
}
this.state.noAnonFunctionType = oldNoAnonFunctionType;
this.expectRelational(">");
this.state.inType = oldInType;