Eliminate ECMA_TRY_CATCH macros part I. (#3006)
Also this patch introduces several helper function to find/put/delete properties by indexed property names to reduce code duplications. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
Dániel Bátyai
parent
3af0079a0e
commit
b47c36ad18
@@ -517,6 +517,27 @@ ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, /**< code uni
|
||||
} /* ecma_new_ecma_string_from_code_units */
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */
|
||||
|
||||
/**
|
||||
* Allocate new ecma-string and fill it with ecma-number
|
||||
*
|
||||
* Note: the number cannot be represented as direct string
|
||||
*
|
||||
* @return pointer to ecma-string descriptor
|
||||
*/
|
||||
ecma_string_t *
|
||||
ecma_new_non_direct_string_from_uint32 (uint32_t uint32_number) /**< uint32 value of the string */
|
||||
{
|
||||
JERRY_ASSERT (uint32_number > ECMA_DIRECT_STRING_MAX_IMM);
|
||||
|
||||
ecma_string_t *string_p = ecma_alloc_string ();
|
||||
|
||||
string_p->refs_and_container = ECMA_STRING_CONTAINER_UINT32_IN_DESC | ECMA_STRING_REF_ONE;
|
||||
string_p->hash = (lit_string_hash_t) uint32_number;
|
||||
string_p->u.uint32_number = uint32_number;
|
||||
|
||||
return string_p;
|
||||
} /* ecma_new_non_direct_string_from_uint32 */
|
||||
|
||||
/**
|
||||
* Allocate new ecma-string and fill it with ecma-number
|
||||
*
|
||||
@@ -530,13 +551,7 @@ ecma_new_ecma_string_from_uint32 (uint32_t uint32_number) /**< uint32 value of t
|
||||
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) uint32_number);
|
||||
}
|
||||
|
||||
ecma_string_t *string_p = ecma_alloc_string ();
|
||||
|
||||
string_p->refs_and_container = ECMA_STRING_CONTAINER_UINT32_IN_DESC | ECMA_STRING_REF_ONE;
|
||||
string_p->hash = (lit_string_hash_t) uint32_number;
|
||||
string_p->u.uint32_number = uint32_number;
|
||||
|
||||
return string_p;
|
||||
return ecma_new_non_direct_string_from_uint32 (uint32_number);
|
||||
} /* ecma_new_ecma_string_from_uint32 */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user