Fix 'eval' checking in import/export statements. (#2978)

Fixes #2975

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai
2019-07-17 14:11:13 +02:00
committed by GitHub
parent 329b1fd3f7
commit a44d584842
6 changed files with 34 additions and 3 deletions
+2 -1
View File
@@ -82,7 +82,8 @@ typedef enum
#endif /* ENABLED (JERRY_ES2015_CLASS) */
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 25), /**< parsing a function or class default export */
PARSER_MODULE_STORE_IDENT = (1u << 26), /**< store identifier of the current export statement */
PARSER_MODULE_STORE_IDENT = (1u << 26), /**< store identifier of the current export statement */
PARSER_IS_EVAL = (1u << 27), /**< eval code */
#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
} parser_general_flags_t;
+1 -2
View File
@@ -493,8 +493,7 @@ parser_module_check_request_place (parser_context_t *context_p) /**< parser cont
{
if (context_p->last_context_p != NULL
|| context_p->stack_top_uint8 != 0
|| (JERRY_CONTEXT (status_flags) & ECMA_STATUS_DIRECT_EVAL) != 0
|| (context_p->status_flags & PARSER_IS_FUNCTION) != 0)
|| (context_p->status_flags & (PARSER_IS_EVAL | PARSER_IS_FUNCTION)) != 0)
{
parser_raise_error (context_p, PARSER_ERR_MODULE_UNEXPECTED);
}
+5
View File
@@ -2397,6 +2397,11 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
context.status_flags |= parse_opts & PARSER_STRICT_MODE_MASK;
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
if (parse_opts & ECMA_PARSE_EVAL)
{
context.status_flags |= PARSER_IS_EVAL;
}
context.module_current_node_p = NULL;
#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */