Moving to replacement of on-stack ecma_object_t* with managed ecma_object_ptr_t.
This commit is contained in:
@@ -35,8 +35,9 @@
|
||||
* @return pointer to ecma-object representing specified error
|
||||
* with reference counter set to one.
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error type */
|
||||
void
|
||||
ecma_new_standard_error (ecma_object_ptr_t &new_error_obj_p, /**< out: object pointer */
|
||||
ecma_standard_error_t error_type) /**< native error type */
|
||||
{
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS
|
||||
ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID__COUNT;
|
||||
@@ -86,23 +87,20 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
|
||||
}
|
||||
}
|
||||
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, prototype_id);
|
||||
|
||||
ecma_object_t *new_error_obj_p = ecma_create_object (prototype_obj_p,
|
||||
true,
|
||||
ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_create_object (new_error_obj_p, prototype_obj_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (new_error_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_ERROR_UL;
|
||||
|
||||
return new_error_obj_p;
|
||||
#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */
|
||||
(void) error_type;
|
||||
|
||||
return ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
ecma_builtin_get (new_error_obj_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */
|
||||
} /* ecma_new_standard_error */
|
||||
|
||||
@@ -112,11 +110,12 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
|
||||
* @return pointer to ecma-object representing specified error
|
||||
* with reference counter set to one.
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_new_standard_error_with_message (ecma_standard_error_t error_type, /**< native error type */
|
||||
void
|
||||
ecma_new_standard_error_with_message (ecma_object_ptr_t &new_error_obj_p, /**< out: object pointer */
|
||||
ecma_standard_error_t error_type, /**< native error type */
|
||||
ecma_string_t* message_string_p) /**< message string */
|
||||
{
|
||||
ecma_object_t *new_error_obj_p = ecma_new_standard_error (error_type);
|
||||
ecma_new_standard_error (new_error_obj_p, error_type);
|
||||
|
||||
ecma_string_t *message_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_MESSAGE);
|
||||
ecma_property_t *prop_p = ecma_create_named_data_property (new_error_obj_p,
|
||||
@@ -126,8 +125,6 @@ ecma_new_standard_error_with_message (ecma_standard_error_t error_type, /**< nat
|
||||
ecma_set_named_data_property_value (prop_p,
|
||||
ecma_value_t (ecma_copy_or_ref_ecma_string (message_string_p)));
|
||||
ecma_deref_ecma_string (message_magic_string_p);
|
||||
|
||||
return new_error_obj_p;
|
||||
} /* ecma_new_standard_error_with_message */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user