Declaration in the head of a for-of loop can't have an initializer (#4804)

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka robert.sipka@h-lab.eu

Co-authored-by: Robert Sipka <robert.sipka@h-lab.eu>
This commit is contained in:
Robert Sipka
2021-10-27 09:51:14 +02:00
committed by GitHub
parent 499cdea75c
commit c6f9ea65ce
3 changed files with 26 additions and 7 deletions
+1 -1
View File
@@ -1414,7 +1414,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
if (context_p->token.type == LEXER_ASSIGN)
{
#if JERRY_ESNEXT
if (context_p->status_flags & PARSER_IS_STRICT)
if ((context_p->status_flags & PARSER_IS_STRICT) || !is_for_in)
{
parser_raise_error (context_p, PARSER_ERR_FOR_IN_OF_DECLARATION);
}