Support dynamic import calls (#4652)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -311,6 +311,20 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
case LEXER_KEYW_IMPORT:
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
|
||||
if (context_p->token.type != LEXER_LEFT_PAREN)
|
||||
{
|
||||
scanner_raise_error (context_p);
|
||||
}
|
||||
|
||||
scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
case LEXER_RIGHT_PAREN:
|
||||
{
|
||||
if (stack_top == SCAN_STACK_PAREN_EXPRESSION)
|
||||
@@ -1681,13 +1695,20 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
case LEXER_KEYW_IMPORT:
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
|
||||
if (context_p->token.type == LEXER_LEFT_PAREN)
|
||||
{
|
||||
scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
|
||||
if (stack_top != SCAN_STACK_SCRIPT)
|
||||
{
|
||||
scanner_raise_error (context_p);
|
||||
}
|
||||
|
||||
scanner_context_p->mode = SCAN_MODE_STATEMENT_END;
|
||||
lexer_next_token (context_p);
|
||||
|
||||
if (context_p->token.type == LEXER_LITERAL
|
||||
&& context_p->token.lit_location.type == LEXER_STRING_LITERAL)
|
||||
|
||||
Reference in New Issue
Block a user