Fix bug with parsing TS generic async arrow function (#9055)

This commit is contained in:
Brian Ng
2018-11-21 15:34:09 -06:00
committed by GitHub
parent e7f0c065cf
commit 4f16a12c03
3 changed files with 140 additions and 0 deletions

View File

@@ -1299,11 +1299,17 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return undefined;
}
const oldInAsync = this.state.inAsync;
const oldInGenerator = this.state.inGenerator;
this.state.inAsync = true;
this.state.inGenerator = false;
res.id = null;
res.generator = false;
res.expression = true; // May be set again by parseFunctionBody.
res.async = true;
this.parseFunctionBody(res, true);
this.state.inAsync = oldInAsync;
this.state.inGenerator = oldInGenerator;
return this.finishNode(res, "ArrowFunctionExpression");
}