Fix ReferenceError for let/const variables in of/in for loop (#3885)

ReferenceError should be thrown when variable is used before assignment

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
This commit is contained in:
Rafal Walczyna
2020-06-10 12:39:02 +02:00
committed by GitHub
parent 1bf52f5847
commit 049a0c43f6
3 changed files with 31 additions and 5 deletions
+1 -1
View File
@@ -2108,7 +2108,7 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
{
if ((literal_p->type & (SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_IS_CONST))
&& literal_p->type & SCANNER_LITERAL_NO_REG)
&& (literal_p->type & SCANNER_LITERAL_IS_USED))
{
literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;
}