@@ -2695,13 +2695,15 @@ namespace ts {
2695
2695
// Didn't appear to actually be a parenthesized arrow function. Just bail out.
2696
2696
return undefined ;
2697
2697
}
2698
+
2699
+ let isAsync = ! ! ( arrowFunction . flags & NodeFlags . Async ) ;
2698
2700
2699
2701
// If we have an arrow, then try to parse the body. Even if not, try to parse if we
2700
2702
// have an opening brace, just in case we're in an error state.
2701
2703
var lastToken = token ;
2702
2704
arrowFunction . equalsGreaterThanToken = parseExpectedToken ( SyntaxKind . EqualsGreaterThanToken , /*reportAtCurrentPosition*/ false , Diagnostics . _0_expected , "=>" ) ;
2703
2705
arrowFunction . body = ( lastToken === SyntaxKind . EqualsGreaterThanToken || lastToken === SyntaxKind . OpenBraceToken )
2704
- ? parseArrowFunctionExpressionBody ( /* isAsync*/ isAsyncFunctionLike ( arrowFunction ) )
2706
+ ? parseArrowFunctionExpressionBody ( isAsync )
2705
2707
: parseIdentifier ( ) ;
2706
2708
2707
2709
return finishNode ( arrowFunction ) ;
@@ -2813,7 +2815,7 @@ namespace ts {
2813
2815
function parseParenthesizedArrowFunctionExpressionHead ( allowAmbiguity : boolean ) : ArrowFunction {
2814
2816
let node = < ArrowFunction > createNode ( SyntaxKind . ArrowFunction ) ;
2815
2817
setModifiers ( node , parseModifiersForArrowFunction ( ) ) ;
2816
- let isAsync = isAsyncFunctionLike ( node ) ;
2818
+ let isAsync = ! ! ( node . flags & NodeFlags . Async ) ;
2817
2819
2818
2820
// Arrow functions are never generators.
2819
2821
//
@@ -3493,7 +3495,7 @@ namespace ts {
3493
3495
node . asteriskToken = parseOptionalToken ( SyntaxKind . AsteriskToken ) ;
3494
3496
3495
3497
let isGenerator = ! ! node . asteriskToken ;
3496
- let isAsync = isAsyncFunctionLike ( node ) ;
3498
+ let isAsync = ! ! ( node . flags & NodeFlags . Async ) ;
3497
3499
node . name =
3498
3500
isGenerator && isAsync ? doInYieldAndAwaitContext ( parseOptionalIdentifier ) :
3499
3501
isGenerator ? doInYieldContext ( parseOptionalIdentifier ) :
@@ -4217,7 +4219,7 @@ namespace ts {
4217
4219
node . asteriskToken = parseOptionalToken ( SyntaxKind . AsteriskToken ) ;
4218
4220
node . name = node . flags & NodeFlags . Default ? parseOptionalIdentifier ( ) : parseIdentifier ( ) ;
4219
4221
let isGenerator = ! ! node . asteriskToken ;
4220
- let isAsync = isAsyncFunctionLike ( node ) ;
4222
+ let isAsync = ! ! ( node . flags & NodeFlags . Async ) ;
4221
4223
fillSignature ( SyntaxKind . ColonToken , /*yieldContext*/ isGenerator , /*awaitContext*/ isAsync , /*requireCompleteParameterList*/ false , node ) ;
4222
4224
node . body = parseFunctionBlockOrSemicolon ( isGenerator , isAsync , Diagnostics . or_expected ) ;
4223
4225
return finishNode ( node ) ;
@@ -4241,7 +4243,7 @@ namespace ts {
4241
4243
method . name = name ;
4242
4244
method . questionToken = questionToken ;
4243
4245
let isGenerator = ! ! asteriskToken ;
4244
- let isAsync = isAsyncFunctionLike ( method ) ;
4246
+ let isAsync = ! ! ( method . flags & NodeFlags . Async ) ;
4245
4247
fillSignature ( SyntaxKind . ColonToken , /*yieldContext*/ isGenerator , /*awaitContext*/ isAsync , /*requireCompleteParameterList*/ false , method ) ;
4246
4248
method . body = parseFunctionBlockOrSemicolon ( isGenerator , isAsync , diagnosticMessage ) ;
4247
4249
return finishNode ( method ) ;
0 commit comments