Fix new.target saving in OrdinaryObject.[[Construct]] (#4060)

This patch fixes #4059.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-07-27 19:32:54 +02:00
committed by GitHub
parent ff36f3579d
commit 39e2bc4df4
2 changed files with 24 additions and 4 deletions
@@ -1336,10 +1336,6 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
return ecma_raise_type_error (message_p);
}
/* 6. */
ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target);
JERRY_CONTEXT (current_new_target) = new_target_p;
/* 5. */
if (!ECMA_GET_THIRD_BIT_FROM_POINTER_TAG (ext_func_obj_p->u.function.scope_cp))
{
@@ -1362,6 +1358,10 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
{
this_arg = ECMA_VALUE_UNDEFINED;
}
/* 6. */
ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target);
JERRY_CONTEXT (current_new_target) = new_target_p;
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_value_t ret_value = ecma_op_function_call_simple (func_obj_p, this_arg, arguments_list_p, arguments_list_len);