Fix incorrect assertion in parser_parse_for_statement_start (#3795)

This patch fixes #3751.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-05-26 11:49:31 +02:00
committed by GitHub
parent 15629e8ba5
commit dd6d148c3b
2 changed files with 29 additions and 5 deletions
+3 -5
View File
@@ -1372,16 +1372,14 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
: CBC_EXT_FOR_OF_GET_NEXT);
#if ENABLED (JERRY_ES2015)
#ifndef JERRY_NDEBUG
if (literal_index >= PARSER_REGISTER_START && has_context)
if (literal_index < PARSER_REGISTER_START
&& has_context
&& !scanner_literal_is_created (context_p, literal_index))
{
context_p->global_status_flags |= ECMA_PARSE_INTERNAL_FOR_IN_OFF_CONTEXT_ERROR;
}
#endif /* !JERRY_NDEBUG */
JERRY_ASSERT (literal_index >= PARSER_REGISTER_START
|| !has_context
|| scanner_literal_is_created (context_p, literal_index));
uint16_t opcode = (has_context ? CBC_ASSIGN_LET_CONST : CBC_ASSIGN_SET_IDENT);
parser_emit_cbc_literal (context_p, opcode, literal_index);
#else /* !ENABLED (JERRY_ES2015) */