perf: call isLineTerminator as last check

This commit is contained in:
Daniel Tschinder 2019-01-16 02:20:25 -08:00
parent 3a3d5cbe9c
commit f216975378
2 changed files with 2 additions and 2 deletions

View File

@ -1281,7 +1281,7 @@ export default class StatementParser extends ExpressionParser {
} else if ( } else if (
isSimple && isSimple &&
(key.name === "get" || key.name === "set") && (key.name === "get" || key.name === "set") &&
!(this.isLineTerminator() && this.match(tt.star)) !(this.match(tt.star) && this.isLineTerminator())
) { ) {
// `get\n*` is an uninitialized property named 'get' followed by a generator. // `get\n*` is an uninitialized property named 'get' followed by a generator.
// a getter or setter // a getter or setter

View File

@ -1319,7 +1319,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
} }
tsCheckLineTerminatorAndMatch(tokenType: TokenType, next: boolean) { tsCheckLineTerminatorAndMatch(tokenType: TokenType, next: boolean) {
return !this.isLineTerminator() && (next || this.match(tokenType)); return (next || this.match(tokenType)) && !this.isLineTerminator();
} }
tsTryParseGenericAsyncArrowFunction( tsTryParseGenericAsyncArrowFunction(