Implement ecma_stringbuilder_create_raw method for stringbuilder (#3584)

With this new method, we can create a stringbuilder from a raw string

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-03-02 15:39:12 +01:00
committed by GitHub
parent ec39d08d67
commit aa17a4fa5d
6 changed files with 30 additions and 11 deletions
@@ -477,9 +477,8 @@ ecma_builtin_string_prototype_object_replace (ecma_value_t this_value, /**< this
{
if (!memcmp (curr_p, search_buf_p, search_size))
{
replace_ctx.builder = ecma_stringbuilder_create ();
const lit_utf8_size_t byte_offset = (lit_utf8_size_t) (curr_p - replace_ctx.string_p);
ecma_stringbuilder_append_raw (&replace_ctx.builder, replace_ctx.string_p, byte_offset);
replace_ctx.builder = ecma_stringbuilder_create_raw (replace_ctx.string_p, byte_offset);
if (replace_ctx.replace_str_p == NULL)
{
@@ -800,9 +800,7 @@ 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);
ecma_stringbuilder_t builder = ecma_stringbuilder_create_raw ((lit_utf8_byte_t *) "Symbol.", 7);
lit_magic_string_id_t symbol_desc_id = (lit_magic_string_id_t) curr_property_p->value;