Skip to content

Commit

Permalink
Allow escaped let as expression (#2916)
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat authored May 8, 2023
1 parent deb8c89 commit d7c03db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions boa_parser/src/parser/statement/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
7 changes: 3 additions & 4 deletions boa_parser/src/parser/statement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _)) => {
Expand Down

0 comments on commit d7c03db

Please sign in to comment.