Fix scope stack lookup for literal indices (#4067)

This patch fixes #4051.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-07-28 10:55:13 +02:00
committed by GitHub
parent 4d5757d1b1
commit 2e2b0dafb0
2 changed files with 26 additions and 2 deletions
+4 -2
View File
@@ -2540,7 +2540,8 @@ scanner_save_literal (parser_context_t *context_p, /**< context */
JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);
scope_stack_p--;
}
while (literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC
|| literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
literal_index = scope_stack_p->map_from;
PARSER_GET_LITERAL (literal_index)->status_flags |= LEXER_FLAG_USED;
@@ -2574,7 +2575,8 @@ scanner_literal_is_const_reg (parser_context_t *context_p, /**< context */
JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);
scope_stack_p--;
}
while (literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC
|| literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
return (scope_stack_p->map_to & PARSER_SCOPE_STACK_IS_CONST_REG) != 0;
} /* scanner_literal_is_const_reg */