Disallow escape sequences in contextual keywords (#9618)
* Disallow escape sequences in async * Disallow escape sequences in get, set and async in class * invalid escape tests * Update whitelist * tests for async in parens * Add test for invalid newline between params and arrow * Move canInsertSemilcolon() into shouldPArseAsyncArrow
This commit is contained in:
@@ -2619,6 +2619,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
startLoc: Position,
|
||||
noCalls: ?boolean,
|
||||
subscriptState: N.ParseSubscriptState,
|
||||
maybeAsyncArrow: boolean,
|
||||
): N.Expression {
|
||||
if (this.match(tt.questionDot) && this.isLookaheadRelational("<")) {
|
||||
this.expectPlugin("optionalChaining");
|
||||
@@ -2671,6 +2672,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
startLoc,
|
||||
noCalls,
|
||||
subscriptState,
|
||||
maybeAsyncArrow,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1498,6 +1498,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
startLoc: Position,
|
||||
noCalls: ?boolean,
|
||||
state: N.ParseSubscriptState,
|
||||
maybeAsyncArrow: boolean,
|
||||
): N.Expression {
|
||||
if (!this.hasPrecedingLineBreak() && this.match(tt.bang)) {
|
||||
this.state.exprAllowed = false;
|
||||
@@ -1560,7 +1561,14 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
if (result) return result;
|
||||
}
|
||||
|
||||
return super.parseSubscript(base, startPos, startLoc, noCalls, state);
|
||||
return super.parseSubscript(
|
||||
base,
|
||||
startPos,
|
||||
startLoc,
|
||||
noCalls,
|
||||
state,
|
||||
maybeAsyncArrow,
|
||||
);
|
||||
}
|
||||
|
||||
parseNewArguments(node: N.NewExpression): void {
|
||||
|
||||
Reference in New Issue
Block a user