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:
@@ -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) */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user