Exporting undeclared variables should throw a SyntaxError (#4276)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai
2020-10-15 14:48:25 +02:00
committed by GitHub
parent f6cf1400bd
commit 650269feca
9 changed files with 62 additions and 4 deletions
+13
View File
@@ -1879,6 +1879,9 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
return SCAN_NEXT_TOKEN;
}
scanner_source_start_t source_start;
source_start.source_p = context_p->source_p;
if (context_p->token.type == LEXER_LEFT_BRACE)
{
lexer_next_token (context_p);
@@ -1924,6 +1927,9 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
return SCAN_KEEP_TOKEN;
}
scanner_info_t *info_p = scanner_insert_info (context_p, source_start.source_p, sizeof (scanner_info_t));
info_p->type = SCANNER_TYPE_EXPORT_MODULE_SPECIFIER;
lexer_next_token (context_p);
if (context_p->token.type != LEXER_LITERAL
@@ -3737,6 +3743,13 @@ scan_completed:
print_location = false;
break;
}
case SCANNER_TYPE_EXPORT_MODULE_SPECIFIER:
{
JERRY_DEBUG_MSG (" EXPORT_WITH_MODULE_SPECIFIER: source:%d\n",
(int) (info_p->source_p - source_start_p));
print_location = false;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
}