Fix await in function name and parameters (#7727)

* Disallow await in function parameters

* Fix await as function name

* Update test whitelists
This commit is contained in:
Nicolò Ribaudo
2018-11-06 08:30:06 +01:00
committed by GitHub
parent 2194842d11
commit 2fa1984635
33 changed files with 963 additions and 51 deletions

View File

@@ -39,7 +39,7 @@ export default class State {
this.decoratorStack = [[]];
this.yieldInPossibleArrowParameters = null;
this.yieldOrAwaitInPossibleArrowParameters = null;
this.tokens = [];
@@ -126,10 +126,10 @@ export default class State {
// where @foo belongs to the outer class and @bar to the inner
decoratorStack: Array<Array<N.Decorator>>;
// The first yield expression inside parenthesized expressions and arrow
// function parameters. It is used to disallow yield in arrow function
// parameters.
yieldInPossibleArrowParameters: ?N.YieldExpression;
// The first yield or await expression inside parenthesized expressions
// and arrow function parameters. It is used to disallow yield and await in
// arrow function parameters.
yieldOrAwaitInPossibleArrowParameters: ?N.YieldExpression;
// Token store.
tokens: Array<Token | N.Comment>;