From 1a3118f8c702b44ab6da12519d1d38f5d1f1f6a2 Mon Sep 17 00:00:00 2001 From: Haled Odat <8566042+HalidOdat@users.noreply.github.com> Date: Mon, 8 May 2023 19:32:42 +0200 Subject: [PATCH] Allow escaped `let` as expression --- boa_parser/src/parser/statement/expression/mod.rs | 5 +---- boa_parser/src/parser/statement/mod.rs | 7 +++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/boa_parser/src/parser/statement/expression/mod.rs b/boa_parser/src/parser/statement/expression/mod.rs index 758e38e211f..287b2240025 100644 --- a/boa_parser/src/parser/statement/expression/mod.rs +++ b/boa_parser/src/parser/statement/expression/mod.rs @@ -47,10 +47,7 @@ where let next_token = cursor.peek(0, interner).or_abrupt()?; match next_token.kind() { - TokenKind::Keyword(( - Keyword::Function | Keyword::Class | Keyword::Async | Keyword::Let, - true, - )) => { + TokenKind::Keyword((Keyword::Function | Keyword::Class | Keyword::Async, true)) => { return Err(Error::general( "Keyword must not contain escaped characters", next_token.span().start(), diff --git a/boa_parser/src/parser/statement/mod.rs b/boa_parser/src/parser/statement/mod.rs index 0e753143241..79eb8678faa 100644 --- a/boa_parser/src/parser/statement/mod.rs +++ b/boa_parser/src/parser/statement/mod.rs @@ -416,10 +416,9 @@ where let tok = cursor.peek(0, interner).or_abrupt()?; match *tok.kind() { - TokenKind::Keyword(( - Keyword::Function | Keyword::Class | Keyword::Const | Keyword::Let, - _, - )) => Declaration::new(self.allow_yield, self.allow_await) + TokenKind::Keyword( + (Keyword::Function | Keyword::Class | Keyword::Const, _) | (Keyword::Let, false), + ) => Declaration::new(self.allow_yield, self.allow_await) .parse(cursor, interner) .map(ast::StatementListItem::from), TokenKind::Keyword((Keyword::Async, _)) => {