Remove new target workaround from super call (#4447)

After #4372 and #4369 all builtin constructors have new target support.

This patch fixes #4446.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2021-01-15 13:28:59 +01:00
committed by GitHub
parent df6d430289
commit 363bc92529
3 changed files with 34 additions and 37 deletions
+3 -20
View File
@@ -1184,30 +1184,13 @@ ecma_op_implicit_constructor_handler_heritage_cb (const ecma_value_t function_ob
if (ecma_is_value_object (result))
{
ecma_value_t proto_value = ecma_op_object_get_by_magic_id (JERRY_CONTEXT (current_new_target),
LIT_MAGIC_STRING_PROTOTYPE);
if (ECMA_IS_VALUE_ERROR (proto_value))
ecma_value_t fields_value = opfunc_init_class_fields (function_obj, result);
if (ECMA_IS_VALUE_ERROR (fields_value))
{
ecma_free_value (result);
result = ECMA_VALUE_ERROR;
}
else
{
if (ecma_is_value_object (proto_value))
{
ECMA_SET_POINTER (ecma_get_object_from_value (result)->u2.prototype_cp,
ecma_get_object_from_value (proto_value));
}
ecma_value_t fields_value = opfunc_init_class_fields (function_obj, result);
if (ECMA_IS_VALUE_ERROR (fields_value))
{
ecma_free_value (result);
result = ECMA_VALUE_ERROR;
}
}
ecma_free_value (proto_value);
}
ecma_deref_object (super_ctor_p);
-17
View File
@@ -606,23 +606,6 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
arguments_p,
arguments_list_len);
if (ecma_is_value_object (completion_value))
{
ecma_value_t proto_value = ecma_op_object_get_by_magic_id (JERRY_CONTEXT (current_new_target),
LIT_MAGIC_STRING_PROTOTYPE);
if (ECMA_IS_VALUE_ERROR (proto_value))
{
ecma_free_value (completion_value);
completion_value = ECMA_VALUE_ERROR;
}
else if (ecma_is_value_object (proto_value))
{
ECMA_SET_POINTER (ecma_get_object_from_value (completion_value)->u2.prototype_cp,
ecma_get_object_from_value (proto_value));
}
ecma_free_value (proto_value);
}
if (!ECMA_IS_VALUE_ERROR (completion_value) && ecma_op_this_binding_is_initialized (environment_record_p))
{
ecma_free_value (completion_value);