File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -2989,11 +2989,14 @@ namespace ts {
2989
2989
}
2990
2990
2991
2991
function tryParseAsyncSimpleArrowFunctionExpression ( ) : ArrowFunction {
2992
- const isUnParenthesizedAsyncArrowFunction = lookAhead ( isUnParenthesizedAsyncArrowFunctionWorker ) ;
2993
- if ( isUnParenthesizedAsyncArrowFunction === Tristate . True ) {
2994
- const asyncModifier = parseModifiersForArrowFunction ( ) ;
2995
- const expr = parseBinaryExpressionOrHigher ( /*precedence*/ 0 ) ;
2996
- return parseSimpleArrowFunctionExpression ( < Identifier > expr , asyncModifier ) ;
2992
+ // We do a check here so that we won't be doing unnecessarily call to "lookAhead"
2993
+ if ( token === SyntaxKind . AsyncKeyword ) {
2994
+ const isUnParenthesizedAsyncArrowFunction = lookAhead ( isUnParenthesizedAsyncArrowFunctionWorker ) ;
2995
+ if ( isUnParenthesizedAsyncArrowFunction === Tristate . True ) {
2996
+ const asyncModifier = parseModifiersForArrowFunction ( ) ;
2997
+ const expr = parseBinaryExpressionOrHigher ( /*precedence*/ 0 ) ;
2998
+ return parseSimpleArrowFunctionExpression ( < Identifier > expr , asyncModifier ) ;
2999
+ }
2997
3000
}
2998
3001
return undefined ;
2999
3002
}
You can’t perform that action at this time.
0 commit comments