Use stringbuilder in jerry_debugger_exception_object_to_string (#3586)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
@@ -1474,11 +1474,9 @@ jerry_debugger_exception_object_to_string (ecma_value_t exception_obj_value) /**
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lit_utf8_size_t size = lit_get_magic_string_size (string_id);
|
ecma_stringbuilder_t builder = ecma_stringbuilder_create ();
|
||||||
JERRY_ASSERT (size <= 14);
|
|
||||||
|
|
||||||
lit_utf8_byte_t data[16];
|
ecma_stringbuilder_append_magic (&builder, string_id);
|
||||||
memcpy (data, lit_get_magic_string_utf8 (string_id), size);
|
|
||||||
|
|
||||||
ecma_property_t *property_p;
|
ecma_property_t *property_p;
|
||||||
property_p = ecma_find_named_property (ecma_get_object_from_value (exception_obj_value),
|
property_p = ecma_find_named_property (ecma_get_object_from_value (exception_obj_value),
|
||||||
@@ -1487,21 +1485,21 @@ jerry_debugger_exception_object_to_string (ecma_value_t exception_obj_value) /**
|
|||||||
if (property_p == NULL
|
if (property_p == NULL
|
||||||
|| ECMA_PROPERTY_GET_TYPE (*property_p) != ECMA_PROPERTY_TYPE_NAMEDDATA)
|
|| ECMA_PROPERTY_GET_TYPE (*property_p) != ECMA_PROPERTY_TYPE_NAMEDDATA)
|
||||||
{
|
{
|
||||||
return ecma_new_ecma_string_from_utf8 (data, size);
|
return ecma_stringbuilder_finalize (&builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
|
ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
|
||||||
|
|
||||||
if (!ecma_is_value_string (prop_value_p->value))
|
if (!ecma_is_value_string (prop_value_p->value))
|
||||||
{
|
{
|
||||||
return ecma_new_ecma_string_from_utf8 (data, size);
|
return ecma_stringbuilder_finalize (&builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
data[size] = LIT_CHAR_COLON;
|
ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COLON);
|
||||||
data[size + 1] = LIT_CHAR_SP;
|
ecma_stringbuilder_append_byte (&builder, LIT_CHAR_SP);
|
||||||
|
ecma_stringbuilder_append (&builder, ecma_get_string_from_value (prop_value_p->value));
|
||||||
|
|
||||||
return ecma_concat_ecma_strings (ecma_new_ecma_string_from_utf8 (data, size + 2),
|
return ecma_stringbuilder_finalize (&builder);
|
||||||
ecma_get_string_from_value (prop_value_p->value));
|
|
||||||
} /* jerry_debugger_exception_object_to_string */
|
} /* jerry_debugger_exception_object_to_string */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user