[TS] Correctly forget awaits after parsing async arrows with type args (#9593)

This commit is contained in:
Nicolò Ribaudo
2019-02-26 20:35:18 +01:00
committed by GitHub
parent 244e4580e9
commit a029071b8f
6 changed files with 359 additions and 17 deletions

View File

@@ -6,13 +6,7 @@ import { types as ct } from "../tokenizer/context";
import * as N from "../types";
import type { Pos, Position } from "../util/location";
import Parser from "../parser";
import {
type BindingTypes,
functionFlags,
BIND_NONE,
SCOPE_ARROW,
SCOPE_OTHER,
} from "../util/scopeflags";
import { type BindingTypes, BIND_NONE, SCOPE_OTHER } from "../util/scopeflags";
type TsModifier =
| "readonly"
@@ -1381,14 +1375,11 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return undefined;
}
this.scope.enter(functionFlags(true, false) | SCOPE_ARROW);
res.id = null;
res.generator = false;
res.expression = true; // May be set again by parseFunctionBody.
res.async = true;
this.parseFunctionBody(res, true);
return this.finishNode(res, "ArrowFunctionExpression");
return this.parseArrowExpression(
res,
/* params are already set */ null,
/* async */ true,
);
}
tsParseTypeArguments(): N.TsTypeParameterInstantiation {