Remove JERRY_CONTEXT_INVALID_NEW_TARGET (#3643)
Until now JERRY_CONTEXT_INVALID_NEW_TARGET was used to represent whether the eval called from the script directly. This information can be retrieved from the parser, so it simplifies the runtime handling of the new.target. This patch fixes #3630, fixes #3640 and fixes #3641. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -99,13 +99,6 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
ECMA_CLEAR_LOCAL_PARSE_OPTS ();
|
||||
|
||||
/* If a direct eval is used inside the function the info should be propagated. */
|
||||
if (JERRY_CONTEXT (current_new_target) != JERRY_CONTEXT_INVALID_NEW_TARGET
|
||||
&& (JERRY_CONTEXT (status_flags) & ECMA_STATUS_DIRECT_EVAL))
|
||||
{
|
||||
parse_opts |= ECMA_PARSE_CALLED_FROM_FUNCTION;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
ecma_value_t parse_status = parser_parse_script (NULL,
|
||||
|
||||
@@ -445,11 +445,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
|
||||
arrow_func_p->this_binding = ecma_copy_value_if_not_object (this_binding);
|
||||
arrow_func_p->new_target = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
if (JERRY_CONTEXT (current_new_target) == JERRY_CONTEXT_INVALID_NEW_TARGET)
|
||||
{
|
||||
arrow_func_p->new_target = ECMA_VALUE_EMPTY;
|
||||
}
|
||||
else if (JERRY_CONTEXT (current_new_target) != NULL)
|
||||
if (JERRY_CONTEXT (current_new_target) != NULL)
|
||||
{
|
||||
arrow_func_p->new_target = ecma_make_object_value (JERRY_CONTEXT (current_new_target));
|
||||
}
|
||||
@@ -792,7 +788,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
|
||||
{
|
||||
JERRY_CONTEXT (current_new_target) = NULL;
|
||||
}
|
||||
else if (ecma_is_value_object (arrow_func_p->new_target))
|
||||
else
|
||||
{
|
||||
JERRY_CONTEXT (current_new_target) = ecma_get_object_from_value (arrow_func_p->new_target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user