Add new target support for object create (#4203)

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
kisbg
2020-10-07 15:07:25 +02:00
committed by GitHub
parent 99c7099eaa
commit 148f69f4a5
4 changed files with 18 additions and 48 deletions
@@ -66,42 +66,6 @@ ecma_op_create_object_object_noarg (void)
return ecma_op_create_object_object_noarg_and_set_prototype (object_prototype_p);
} /* ecma_op_create_object_object_noarg */
/**
* 'Object' object creation operation with one argument.
*
* See also: ECMA-262 v5, 15.2.2.1
*
* @return pointer to newly created 'Object' object
*/
ecma_value_t
ecma_op_create_object_object_arg (ecma_value_t value) /**< argument of constructor */
{
ecma_check_value_type_is_spec_defined (value);
if (!ecma_is_value_undefined (value)
&& !ecma_is_value_null (value))
{
/* 1.b, 1.c, 1.d */
JERRY_ASSERT (ecma_is_value_object (value)
|| ecma_is_value_number (value)
|| ecma_is_value_prop_name (value)
|| ecma_is_value_boolean (value)
|| ecma_is_value_bigint (value));
return ecma_op_to_object (value);
}
else
{
/* 2. */
JERRY_ASSERT (ecma_is_value_undefined (value)
|| ecma_is_value_null (value));
ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
return ecma_make_object_value (obj_p);
}
} /* ecma_op_create_object_object_arg */
/**
* Object creation operation with no arguments.
* It sets the given prototype to the newly created object.
@@ -28,7 +28,6 @@
ecma_value_t ecma_reject (bool is_throw);
ecma_object_t *ecma_op_create_object_object_noarg (void);
ecma_value_t ecma_op_create_object_object_arg (ecma_value_t value);
ecma_object_t *ecma_op_create_object_object_noarg_and_set_prototype (ecma_object_t *object_prototype_p);
ecma_value_t ecma_op_general_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw);