File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -1372,16 +1372,14 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
13721372 : CBC_EXT_FOR_OF_GET_NEXT );
13731373#if ENABLED (JERRY_ES2015 )
13741374#ifndef JERRY_NDEBUG
1375- if (literal_index >= PARSER_REGISTER_START && has_context )
1375+ if (literal_index < PARSER_REGISTER_START
1376+ && has_context
1377+ && !scanner_literal_is_created (context_p , literal_index ))
13761378 {
13771379 context_p -> global_status_flags |= ECMA_PARSE_INTERNAL_FOR_IN_OFF_CONTEXT_ERROR ;
13781380 }
13791381#endif /* !JERRY_NDEBUG */
13801382
1381- JERRY_ASSERT (literal_index >= PARSER_REGISTER_START
1382- || !has_context
1383- || scanner_literal_is_created (context_p , literal_index ));
1384-
13851383 uint16_t opcode = (has_context ? CBC_ASSIGN_LET_CONST : CBC_ASSIGN_SET_IDENT );
13861384 parser_emit_cbc_literal (context_p , opcode , literal_index );
13871385#else /* !ENABLED (JERRY_ES2015) */
Original file line number Diff line number Diff line change 1+ // Copyright JS Foundation and other contributors, http://js.foundation
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ try {
16+ eval ( `for (let i in {
17+ id_0: 1
18+ })
19+
20+ (function() {
21+ i
22+ ` ) ;
23+ assert ( false ) ;
24+ } catch ( e ) {
25+ assert ( e instanceof SyntaxError ) ;
26+ }
You can’t perform that action at this time.
0 commit comments