From b4b9edc04ca081d0bca04cd7f851a83ea3f6888c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 21 Nov 2017 18:39:01 -0800 Subject: [PATCH] Make sure 'async' isn't treated as a parameter modifier --- src/compiler/parser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b13aaac792..cb28be4677 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3281,7 +3281,7 @@ namespace ts { // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (isModifierKind(second) && lookAhead(nextTokenIsIdentifier)) { + if (isModifierKind(second) && second !== SyntaxKind.AsyncKeyword && lookAhead(nextTokenIsIdentifier)) { return Tristate.True; } @@ -3298,7 +3298,7 @@ namespace ts { return Tristate.True; case SyntaxKind.QuestionToken: nextToken(); - // If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lamnda. + // If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda. if (token() === SyntaxKind.ColonToken || token() === SyntaxKind.CommaToken || token() === SyntaxKind.EqualsToken || token() === SyntaxKind.CloseParenToken) { return Tristate.True; }