mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Use stringbuilder in ecma_builtin_try_to_instantiate_property (#3575)
Also removed the ecma_append_magic_string_to_string method, because it doesn't get used anymore. JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
parent
acbdb4184f
commit
cdbabc8c30
@ -784,30 +784,6 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
|
||||
return result_p;
|
||||
} /* ecma_concat_ecma_strings */
|
||||
|
||||
/**
|
||||
* Append a magic string after an ecma-string
|
||||
*
|
||||
* Note:
|
||||
* The string1_p argument is freed. If it needs to be preserved,
|
||||
* call ecma_ref_ecma_string with string1_p before the call.
|
||||
*
|
||||
* @return concatenation of an ecma-string and a magic string
|
||||
*/
|
||||
ecma_string_t *
|
||||
ecma_append_magic_string_to_string (ecma_string_t *string1_p, /**< string descriptor */
|
||||
lit_magic_string_id_t string2_id) /**< magic string ID */
|
||||
{
|
||||
if (JERRY_UNLIKELY (ecma_string_is_empty (string1_p)))
|
||||
{
|
||||
return ecma_get_magic_string (string2_id);
|
||||
}
|
||||
|
||||
const lit_utf8_byte_t *cesu8_string2_p = lit_get_magic_string_utf8 (string2_id);
|
||||
lit_utf8_size_t cesu8_string2_size = lit_get_magic_string_size (string2_id);
|
||||
|
||||
return ecma_append_chars_to_string (string1_p, cesu8_string2_p, cesu8_string2_size, cesu8_string2_size);
|
||||
} /* ecma_append_magic_string_to_string */
|
||||
|
||||
/**
|
||||
* Increase reference counter of ecma-string.
|
||||
*/
|
||||
|
||||
@ -257,7 +257,6 @@ ecma_string_t *ecma_append_chars_to_string (ecma_string_t *string1_p,
|
||||
lit_utf8_size_t cesu8_string2_size,
|
||||
lit_utf8_size_t cesu8_string2_length);
|
||||
ecma_string_t *ecma_concat_ecma_strings (ecma_string_t *string1_p, ecma_string_t *string2_p);
|
||||
ecma_string_t *ecma_append_magic_string_to_string (ecma_string_t *string1_p, lit_magic_string_id_t string2_id);
|
||||
void ecma_ref_ecma_string (ecma_string_t *string_p);
|
||||
void ecma_deref_ecma_string (ecma_string_t *string_p);
|
||||
void ecma_destroy_ecma_string (ecma_string_t *string_p);
|
||||
|
||||
@ -793,13 +793,15 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case ECMA_BUILTIN_PROPERTY_SYMBOL:
|
||||
{
|
||||
ecma_stringbuilder_t builder = ecma_stringbuilder_create ();
|
||||
|
||||
ecma_stringbuilder_append_raw (&builder, (lit_utf8_byte_t *) "Symbol.", 7);
|
||||
|
||||
lit_magic_string_id_t symbol_desc_id = (lit_magic_string_id_t) curr_property_p->value;
|
||||
|
||||
ecma_string_t *symbol_desc_p;
|
||||
symbol_desc_p = ecma_append_magic_string_to_string (ecma_get_magic_string (LIT_MAGIC_STRING_SYMBOL_DOT_UL),
|
||||
symbol_desc_id);
|
||||
ecma_stringbuilder_append_magic (&builder, symbol_desc_id);
|
||||
|
||||
ecma_value_t symbol_desc_value = ecma_make_string_value (symbol_desc_p);
|
||||
ecma_value_t symbol_desc_value = ecma_make_string_value (ecma_stringbuilder_finalize (&builder));
|
||||
|
||||
ecma_string_t *symbol_p = ecma_new_symbol_from_descriptor_string (symbol_desc_value);
|
||||
lit_magic_string_id_t symbol_id = (lit_magic_string_id_t) curr_property_p->magic_string_id;
|
||||
|
||||
@ -371,9 +371,6 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REFLECT_UL, "Reflect")
|
||||
#if ENABLED (JERRY_BUILTIN_MATH)
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT1_2_U, "SQRT1_2")
|
||||
#endif
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_DOT_UL, "Symbol.")
|
||||
#endif
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \
|
||||
|| ENABLED (JERRY_ES2015_BUILTIN_WEAKMAP)
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKMAP_UL, "WeakMap")
|
||||
|
||||
@ -159,7 +159,6 @@ LIT_MAGIC_STRING_BOOLEAN_UL = "Boolean"
|
||||
LIT_MAGIC_STRING_PROMISE_UL = "Promise"
|
||||
LIT_MAGIC_STRING_REFLECT_UL = "Reflect"
|
||||
LIT_MAGIC_STRING_SQRT1_2_U = "SQRT1_2"
|
||||
LIT_MAGIC_STRING_SYMBOL_DOT_UL = "Symbol."
|
||||
LIT_MAGIC_STRING_BOOLEAN = "boolean"
|
||||
LIT_MAGIC_STRING_COMPILE = "compile"
|
||||
LIT_MAGIC_STRING_DEFAULT = "default"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user