Set exprAllowed to false when parsing TSNonNullExpression (#7968)

This commit is contained in:
Brian Ng
2018-05-24 09:31:08 -05:00
committed by GitHub
parent 7489f8da7b
commit a94cbf760a
7 changed files with 373 additions and 1 deletions

View File

@@ -1343,7 +1343,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
noCalls: ?boolean,
state: N.ParseSubscriptState,
): N.Expression {
if (!this.hasPrecedingLineBreak() && this.eat(tt.bang)) {
if (!this.hasPrecedingLineBreak() && this.match(tt.bang)) {
this.state.exprAllowed = false;
this.next();
const nonNullExpression: N.TsNonNullExpression = this.startNodeAt(
startPos,
startLoc,