diff --git a/jerry-core/parser/js/js-parser-statm.c b/jerry-core/parser/js/js-parser-statm.c index 4c00fdc3b..9b0da3254 100644 --- a/jerry-core/parser/js/js-parser-statm.c +++ b/jerry-core/parser/js/js-parser-statm.c @@ -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); } diff --git a/tests/jerry/initializer-in-for-of-statement-head.js b/tests/jerry/initializer-in-for-of-statement-head.js new file mode 100644 index 000000000..3bcdd6826 --- /dev/null +++ b/tests/jerry/initializer-in-for-of-statement-head.js @@ -0,0 +1,25 @@ +/* Copyright JS Foundation and other contributors, http://js.foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function parse(txt) { + try { + eval(txt) + assert(false) + } catch (e) { + assert(e instanceof SyntaxError) + } +} + +parse("for (var x = 1 of []) { }") diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml index a8a95dc6e..aaa42b9f3 100644 --- a/tests/test262-esnext-excludelist.xml +++ b/tests/test262-esnext-excludelist.xml @@ -343,11 +343,8 @@ - - - @@ -7702,9 +7699,6 @@ - - -