Skip to content

Commit

Permalink
perf: call isLineTerminator as last check
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Jan 18, 2019
1 parent 3a3d5cb commit f216975
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/babel-parser/src/parser/statement.js
Expand Up @@ -1281,7 +1281,7 @@ export default class StatementParser extends ExpressionParser {
} else if (
isSimple &&
(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.
// a getter or setter
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/plugins/typescript.js
Expand Up @@ -1319,7 +1319,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
}

tsCheckLineTerminatorAndMatch(tokenType: TokenType, next: boolean) {
return !this.isLineTerminator() && (next || this.match(tokenType));
return (next || this.match(tokenType)) && !this.isLineTerminator();
}

tsTryParseGenericAsyncArrowFunction(
Expand Down

0 comments on commit f216975

Please sign in to comment.