From f58f15077f4ca975285025e484cbff58fc061ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20B=C3=A1tyai?= Date: Fri, 25 Sep 2020 16:33:11 +0200 Subject: [PATCH] Bound names of for-in/of statements cannot contain let (#4225) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu --- jerry-core/parser/js/js-parser-statm.c | 9 +++++++++ tests/test262-es6-excludelist.xml | 1 - tests/test262-esnext-excludelist.xml | 5 ----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/jerry-core/parser/js/js-parser-statm.c b/jerry-core/parser/js/js-parser-statm.c index edc634859..4ba83fc8e 100644 --- a/jerry-core/parser/js/js-parser-statm.c +++ b/jerry-core/parser/js/js-parser-statm.c @@ -1374,6 +1374,15 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */ #endif /* ENABLED (JERRY_ESNEXT) */ lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL); + +#if ENABLED (JERRY_ESNEXT) + if (context_p->token.keyword_type == LEXER_KEYW_LET + && token_type != LEXER_KEYW_VAR) + { + parser_raise_error (context_p, PARSER_ERR_LEXICAL_LET_BINDING); + } +#endif /* ENABLED (JERRY_ESNEXT) */ + JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL); diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index cc9a56ad4..a1a0f25e0 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -325,7 +325,6 @@ - ES2019 change: catch without parameter is allowed Unicode 13: 0x180E is no longer whitespace character Unicode 13: 0x180E is no longer whitespace character diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml index 086105064..d498d2b4b 100644 --- a/tests/test262-esnext-excludelist.xml +++ b/tests/test262-esnext-excludelist.xml @@ -4500,8 +4500,6 @@ - - @@ -4579,11 +4577,9 @@ - - @@ -4661,7 +4657,6 @@ -