Refactor ecma_op_to_string (#3171)
Similar to the ecma_op_to_object rework, in this new method we return directly with the pointer to the ecma string, and we don't wrap the result into an ecma_value_t JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
committed by
Robert Fancsik
parent
b7aa21ebc7
commit
4b352758c1
@@ -132,9 +132,9 @@ opfunc_addition (ecma_value_t left_value, /**< left value */
|
||||
if (ecma_is_value_string (left_value)
|
||||
|| ecma_is_value_string (right_value))
|
||||
{
|
||||
ecma_value_t str_left_value = ecma_op_to_string (left_value);
|
||||
ecma_string_t *string1_p = ecma_op_to_string (left_value);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (str_left_value))
|
||||
if (JERRY_UNLIKELY (string1_p == NULL))
|
||||
{
|
||||
if (free_left_value)
|
||||
{
|
||||
@@ -144,14 +144,12 @@ opfunc_addition (ecma_value_t left_value, /**< left value */
|
||||
{
|
||||
ecma_free_value (right_value);
|
||||
}
|
||||
return str_left_value;
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ecma_string_t *string1_p = ecma_get_string_from_value (str_left_value);
|
||||
ecma_string_t *string2_p = ecma_op_to_string (right_value);
|
||||
|
||||
ecma_value_t str_right_value = ecma_op_to_string (right_value);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (str_right_value))
|
||||
if (JERRY_UNLIKELY (string2_p == NULL))
|
||||
{
|
||||
if (free_right_value)
|
||||
{
|
||||
@@ -162,11 +160,9 @@ opfunc_addition (ecma_value_t left_value, /**< left value */
|
||||
ecma_free_value (left_value);
|
||||
}
|
||||
ecma_deref_ecma_string (string1_p);
|
||||
return str_right_value;
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ecma_string_t *string2_p = ecma_get_string_from_value (str_right_value);
|
||||
|
||||
string1_p = ecma_concat_ecma_strings (string1_p, string2_p);
|
||||
ret_value = ecma_make_string_value (string1_p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user