diff --git a/boa_parser/src/parser/statement/iteration/for_statement.rs b/boa_parser/src/parser/statement/iteration/for_statement.rs index 2a5c27cc18..3c839d727b 100644 --- a/boa_parser/src/parser/statement/iteration/for_statement.rs +++ b/boa_parser/src/parser/statement/iteration/for_statement.rs @@ -116,7 +116,21 @@ where .into(), ) } - TokenKind::Keyword((Keyword::Let | Keyword::Const, _)) => Some( + TokenKind::Keyword((Keyword::Let, _)) => Some('exit: { + if !cursor.strict() { + if let Some(token) = cursor.peek(1, interner)? { + if token.kind() == &TokenKind::Keyword((Keyword::In, false)) { + cursor.advance(interner); + break 'exit boa_ast::Expression::Identifier(Sym::LET.into()).into(); + } + } + } + + LexicalDeclaration::new(false, self.allow_yield, self.allow_await, true) + .parse(cursor, interner)? + .into() + }), + TokenKind::Keyword((Keyword::Const, _)) => Some( LexicalDeclaration::new(false, self.allow_yield, self.allow_await, true) .parse(cursor, interner)? .into(),