From 8b14220c3c71e7cf16c0b411b23fa432592768a3 Mon Sep 17 00:00:00 2001 From: Martok Date: Fri, 17 Jun 2022 21:00:15 +0200 Subject: [PATCH] Issue #1918 - m-c 1345960: Handle shorthand property and destructuring with async keyword properly. This was previously partially present, but got lost along the way --- js/src/frontend/Parser.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 15c3448013..1969628f38 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -9743,13 +9743,14 @@ Parser::propertyName(YieldHandling yieldHandling, // ComputedPropertyName[Yield, Await]: // [ ... TokenKind tt = TOK_EOF; - if (!tokenStream.getToken(&tt)) + if (!tokenStream.peekTokenSameLine(&tt)) return null(); - if (tt != TOK_LP && tt != TOK_COLON && tt != TOK_RC && tt != TOK_ASSIGN) { + if (tt == TOK_STRING || tt == TOK_NUMBER || tt == TOK_LB || + TokenKindIsPossibleIdentifierName(tt)) + { isAsync = true; + tokenStream.consumeKnownToken(tt); ltok = tt; - } else { - tokenStream.ungetToken(); } }