Added new target support to Promise (#3707)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
@@ -493,11 +493,20 @@ ecma_value_t
|
||||
ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function or object */
|
||||
ecma_promise_executor_type_t type) /**< indicates the type of executor */
|
||||
{
|
||||
JERRY_ASSERT (JERRY_CONTEXT (current_new_target) != NULL);
|
||||
/* 3. */
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE_PROTOTYPE);
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
|
||||
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target),
|
||||
ECMA_BUILTIN_ID_PROMISE_PROTOTYPE);
|
||||
|
||||
if (JERRY_UNLIKELY (proto_p == NULL))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ecma_object_t *object_p = ecma_create_object (proto_p,
|
||||
sizeof (ecma_promise_object_t),
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_deref_object (proto_p);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_PROMISE_UL;
|
||||
ext_object_p->u.class_prop.u.value = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
Reference in New Issue
Block a user