ronantakizawa/codereview-bench huggingface dataset:
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-conversion.c (C)

Code before:
  }
  else if (ecma_is_value_float_number (value))
  {
    ecma_number_t num = ecma_get_float_from_value (value);
    return ecma_new_ecma_string_from_number (num);
  }
  else if (ecma_is_value_undefined (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_UNDEFINED);
  }
  else if (ecma_is_value_null (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_NULL);
  }
#if ENABLED (JERRY_ES2015)
  else if (ecma_is_value_symbol (value))
  {
    ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a string."));
    return NULL;
  }
#endif /* ENABLED (JERRY_ES2015) */
  else if (ecma_is_value_true (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_TRUE);
  }
  else if (ecma_is_value_false (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_FALSE);
  }

  JERRY_ASSERT (ecma_is_value_object (value));

  ecma_value_t prim_value = ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING);

  if (ECMA_IS_VALUE_ERROR (prim_value))
  {
    return NULL;
  }

  ecma_string_t *ret_string_p = ecma_op_to_string (prim_value);

  ecma_free_value (prim_value);

  return ret_string_p;
} /* ecma_op_to_string */

/**
 * ToPropertyName operation.
 *
 * @return NULL - if the conversion fails
 *         ecma-string - otherwise

Review comment (suggestion):
Since each condition returns a with a value here and above I'd suggest to use only `if`s instead of `else if`s.

Code after:

    if (num < 0)
    {
      return ecma_new_ecma_string_from_number ((ecma_number_t) num);
    }
    else
    {
      return ecma_new_ecma_string_from_uint32 ((uint32_t) num);
    }
  }

  if (ecma_is_value_float_number (value))
  {
    ecma_number_t num = ecma_get_float_from_value (value);
    return ecma_new_ecma_string_from_number (num);
  }

  if (ecma_is_value_undefined (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_UNDEFINED);
  }

  if (ecma_is_value_null (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_NULL);
  }

#if ENABLED (JERRY_ESNEXT)
  if (ecma_is_value_symbol (value))
  {
    ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a string."));
    return NULL;
  }
#endif /* ENABLED (JERRY_ESNEXT) */

  if (ecma_is_value_true (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_TRUE);
  }

  if (ecma_is_value_false (value))
  {
    return ecma_get_magic_string (LIT_MAGIC_STRING_FALSE);
  }

  JERRY_ASSERT (ecma_is_value_object (value));

  ecma_object_t *obj_p = ecma_get_object_from_value (value);

  ecma_value_t def_value = ecma_op_object_default_value (obj_p, ECMA_PREFERRED_TYPE_STRING);
Repository: jerryscript-project/jerryscript
File: tests/jerry/es.next/object-get-own-property-descriptors.js (JavaScript)

Code before:
  configurable: true,
};

var descriptor2 = {
  value: "foo",
  writable: true,
  enumerable: false,
  configurable: true,
};

var descriptor3 = {
  value: undefined,
  writable: false,
  enumerable: true,
  configurable: false,
};

Object.defineProperties(object, {
  "property1": descriptor1,
  "property2": descriptor2,
  "property3": descriptor3,
});

var descriptors = Object.getOwnPropertyDescriptors(object);

assert(JSON.stringify(Object.getOwnPropertyNames(descriptors)) === '["property1","property2","property3"]');

assert(descriptors.property1.value === 42);
assert(descriptors.property1.writable === true);
assert(descriptors.property1.enumerable === true);
assert(descriptors.property1.configurable === true);

assert(descriptors.property2.value === "foo");
assert(descriptors.property2.writable === true);
assert(descriptors.property2.enumerable === false);
assert(descriptors.property2.configurable === true);

assert(descriptors.property3.value === undefined);
assert(descriptors.property3.writable === false);
assert(descriptors.property3.enumerable === true);
assert(descriptors.property3.configurable === false);

/* Compare getOwnPropertyDescriptor and getOwnPropertyDescriptors. */
for (let i of Object.getOwnPropertyNames(object)) {
  let lhs = JSON.stringify(Object.getOwnPropertyDescriptor(object, i));
  let rhs = JSON.stringify(descriptors[i]);

  assert(lhs === rhs);
}

var array_desc = Object.getOwnPropertyDescriptors(Array);

Review comment (suggestion):
Please avoid comparing arrays as JSON strings. There should be an `array_check` method in other test cases which can be used here also.

Code after:
// Append a symbol property.
object[symbol] = "symbol";

Object.defineProperties(object, {
  "foo" : {
    get: getter,
    set: setter,
    enumerable: true,
    configurable: true,
  },
  "bar": {
    value: "bar",
    writable: true,
    enumerable: false,
    configurable: true,
  },
  "baz": {
    value: undefined,
    writable: false,
    enumerable: true,
    configurable: false,
  },
});

var descriptors = Object.getOwnPropertyDescriptors(object);

// All the descriptor keys should be enumerable.
var keys = Object.keys(descriptors);
var names = Object.getOwnPropertyNames(descriptors);
var symbols = Object.getOwnPropertySymbols(descriptors);

assert(keys.length === names.length);
assert(symbols.length === 1);

for (var idx = 0; idx < keys.length; idx++) {
  assert(keys[idx] === names[idx]);
}

assert(descriptors[symbol].value === "symbol");

assert(descriptors["foo"].get === getter);
assert(descriptors["foo"].set === setter);
assert(descriptors["foo"].enumerable === true);
assert(descriptors["foo"].configurable === true);

assert(descriptors["bar"].value === "bar");
assert(descriptors["bar"].writable === true);
assert(descriptors["bar"].enumerable === false);
assert(descriptors["bar"].configurable === true);

assert(descriptors["baz"].value === undefined);
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c (C)

Code before:
    }

    ecma_object_t *obj_p = ecma_get_object_from_value (to_object);

    ecma_value_t ret_value;

    if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_IS_PROTOTYPE_OF)
    {
      ret_value = ecma_builtin_object_prototype_object_is_prototype_of (obj_p, arguments_list_p[0]);
    }

#if ENABLED (JERRY_ESNEXT)
    else if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_GET_PROTO)
    {
      ret_value = ecma_builtin_object_object_get_prototype_of (obj_p);
    }
#endif /* ENABLED (JERRY_ESNEXT)*/

    else
    {
#if ENABLED (JERRY_ESNEXT)
      ecma_value_t this_parameter = this_arg;
#else /* !ENABLED (JERRY_ESNEXT) */
      ecma_value_t this_parameter = ecma_make_object_value (obj_p);
#endif /* ENABLED (JERRY_ESNEXT) */
      ret_value = ecma_builtin_object_prototype_object_to_locale_string (this_parameter);
    }

    ecma_deref_object (obj_p);

    return ret_value;
  }

  JERRY_ASSERT (builtin_routine_id >= ECMA_OBJECT_PROTOTYPE_HAS_OWN_PROPERTY);

#if ENABLED (JERRY_ESNEXT)
  if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_SET_PROTO)
  {
    return ecma_builtin_object_object_set_proto (this_arg, arguments_list_p[0]);
  }
#endif /* ENABLED (JERRY_ESNEXT)*/

  ecma_string_t *prop_name_p = ecma_op_to_prop_name (arguments_list_p[0]);

  if (prop_name_p == NULL)
  {
    return ECMA_VALUE_ERROR;
  }

  ecma_value_t to_object = ecma_op_to_object (this_arg);


Review comment (suggestion):
This way the ToObject wil be called twice on the `this_parameter` argument: One is a bit above where the `obj_p` is initialized and the other one is in the underlying invoke method.

Code after:
    ecma_value_t to_object = ecma_op_to_object (this_arg);

    if (ECMA_IS_VALUE_ERROR (to_object))
    {
      return to_object;
    }

    ecma_object_t *obj_p = ecma_get_object_from_value (to_object);

    ecma_value_t ret_value;

#if ENABLED (JERRY_ESNEXT)
    if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_GET_PROTO)
    {
      ret_value = ecma_builtin_object_object_get_prototype_of (obj_p);
    }
    else
#endif /* ENABLED (JERRY_ESNEXT)*/
    {
      ret_value = ecma_builtin_object_prototype_object_is_prototype_of (obj_p, arguments_list_p[0]);
    }

    ecma_deref_object (obj_p);

    return ret_value;
  }

  JERRY_ASSERT (builtin_routine_id >= ECMA_OBJECT_PROTOTYPE_HAS_OWN_PROPERTY);

#if ENABLED (JERRY_ESNEXT)
  if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_SET_PROTO)
  {
    return ecma_builtin_object_object_set_proto (this_arg, arguments_list_p[0]);
  }
#endif /* ENABLED (JERRY_ESNEXT)*/

  ecma_string_t *prop_name_p = ecma_op_to_prop_name (arguments_list_p[0]);

  if (prop_name_p == NULL)
  {
    return ECMA_VALUE_ERROR;
  }

  ecma_value_t to_object = ecma_op_to_object (this_arg);

  if (ECMA_IS_VALUE_ERROR (to_object))
  {
    ecma_deref_ecma_string (prop_name_p);
    return to_object;
  }
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c (C)

Code before:
      if (ecma_builtin_helper_string_find_index (original_str_p, search_str_p, start, &index_of) != UINT32_MAX)
      {
        /* 15, 16 (startsWith) */
        ret_value = ecma_make_boolean_value (index_of == start);
      }
      break;
    }
    case ECMA_STRING_INCLUDES:
    {
      if (ecma_builtin_helper_string_find_index (original_str_p, search_str_p, start, &index_of) != UINT32_MAX)
      {
        ret_value = ECMA_VALUE_TRUE;
      }
      break;
    }
    case ECMA_STRING_ENDS_WITH:
    {
      if (start == 0)
      {
        start = original_len;
      }

      ecma_length_t search_str_len = ecma_string_get_length (search_str_p);

      if (search_str_len == 0)
      {
        ret_value = ECMA_VALUE_TRUE;
        break;
      }

      int32_t start_ends_with = (int32_t) (start - search_str_len);

      if (start_ends_with < 0)
      {
        break;
      }
      if (ecma_builtin_helper_string_find_index (original_str_p, search_str_p,
                                                 (ecma_length_t) start_ends_with, &index_of) != UINT32_MAX)
      {
        ret_value = ecma_make_boolean_value (index_of == (ecma_length_t) start_ends_with);
      }
      break;
    }
#endif /* ENABLED (JERRY_ESNEXT) */

    case ECMA_STRING_INDEX_OF:
    {
      /* 8 (indexOf) -- 9 (lastIndexOf) */
      if (ecma_builtin_helper_string_find_index (original_str_p, search_str_p, start, &index_of) != UINT32_MAX)
      {
        ret_num = ((ecma_number_t) index_of);

Review comment (refactor):
I think it would make more sense to use `ecma_builtin_helper_string_find_last_index` for `ECMA_STRING_ENDS_WITH`.

Code after:
      {
        break;
      }
      uint32_t index = ecma_builtin_helper_string_find_index (original_str_p,
                                                              search_str_p,
                                                              (uint32_t) start_ends_with);
      ret_value = ecma_make_boolean_value (index  == (uint32_t) start_ends_with);
      break;
    }
#endif /* ENABLED (JERRY_ESNEXT) */

    case ECMA_STRING_INDEX_OF:
    {
      /* 8 (indexOf) -- 9 (lastIndexOf) */
      ecma_value_t find_index = ecma_builtin_helper_string_find_index (original_str_p, search_str_p, start);

      if (find_index != UINT32_MAX)
      {
        ret_num = ((ecma_number_t) find_index);
      }
      ret_value = ecma_make_number_value (ret_num);
      break;
    }

    case ECMA_STRING_LAST_INDEX_OF:
    {
      uint32_t index = ecma_builtin_helper_string_find_last_index (original_str_p, search_str_p, start);

      if (index != UINT32_MAX)
      {
        ret_num = ((ecma_number_t) index);
      }
      ret_value = ecma_make_number_value (ret_num);
      break;
    }

    default:
    {
      JERRY_UNREACHABLE ();
    }
  }

  ecma_deref_ecma_string (search_str_p);

  return ret_value;
} /* ecma_builtin_helper_string_prototype_object_index_of */

/**
 * Helper function for finding index of a search string
 *
 * This function clamps the given index to the [0, length] range.
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c (C)

Code before:
{
  ecma_number_t num_pos;

  if (ECMA_IS_VALUE_ERROR (ecma_get_number (position, &num_pos)))
  {
    return ECMA_VALUE_ERROR;
  }

  if (ecma_number_is_nan (num_pos))
  {
    num_pos = ecma_number_make_infinity (false);
  }
  else
  {
    ecma_value_t num_value = ecma_make_number_value (num_pos);
    ecma_value_t conv_result = ecma_op_to_integer (num_value, &num_pos);
    ecma_free_value (num_value);
    JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (conv_result));
  }

  ECMA_STRING_TO_UTF8_STRING (search_str_p, search_str_utf8_p, search_str_size);
  ECMA_STRING_TO_UTF8_STRING (original_str_p, original_str_utf8_p, original_str_size);

  uint32_t original_length = ecma_string_get_length (original_str_p);
  uint32_t start = ecma_builtin_helper_string_index_normalize (num_pos, original_length, true);

  if (ecma_string_is_empty (search_str_p))
  {
    return ecma_make_uint32_value (start);
  }

  const lit_utf8_byte_t *end_p = original_str_utf8_p + original_str_size;
  const lit_utf8_byte_t *end = original_str_utf8_p + original_str_size;
  uint32_t pos = original_length;

  for (ecma_number_t i = pos; i > start; i--)
  {
    lit_utf8_decr (&end_p);
  }

  ecma_value_t ret_value = ECMA_VALUE_EMPTY;

  while (true)
  {
    if (end_p + search_str_size <= end
        && memcmp (end_p, search_str_utf8_p, search_str_size) == 0)
    {
      ret_value = ecma_make_uint32_value (start);
      break;
    }


Review comment (suggestion):
At this point the string buffers will leak. The two `ECMA_STRING_TO_UTF8_STRING` calls should be moved below this block.

Code after:
{
  if (ecma_string_is_empty (search_str_p))
  {
    return position;
  }

  uint32_t original_length = ecma_string_get_length (original_str_p);

  ECMA_STRING_TO_UTF8_STRING (search_str_p, search_str_utf8_p, search_str_size);
  ECMA_STRING_TO_UTF8_STRING (original_str_p, original_str_utf8_p, original_str_size);

  uint32_t ret_value = UINT32_MAX;

  if (original_str_size >= search_str_size)
  {
    const lit_utf8_byte_t *end_p = original_str_utf8_p + original_str_size;
    const lit_utf8_byte_t *current_p = end_p;

    for (ecma_number_t i = original_length; i > position; i--)
    {
      lit_utf8_decr (&current_p);
    }

    while (current_p + search_str_size > end_p)
    {
      lit_utf8_decr (&current_p);
      position--;
    }

    while (true)
    {
      if (memcmp (current_p, search_str_utf8_p, search_str_size) == 0)
      {
        ret_value = position;
        break;
      }

      if (position == 0)
      {
        break;
      }

      lit_utf8_decr (&current_p);
      position--;
    }
  }
  ECMA_FINALIZE_UTF8_STRING (original_str_utf8_p, original_str_size);
  ECMA_FINALIZE_UTF8_STRING (search_str_utf8_p, search_str_size);

  return ret_value;
} /* ecma_builtin_helper_string_find_last_index */
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c (C)

Code before:
  const lit_utf8_byte_t  *current_p = end_p;

  for (ecma_number_t i = original_length; i > position; i--)
  {
    lit_utf8_decr (&end_p);
  }

  uint32_t ret_value = UINT32_MAX;

  while (true)
  {
    if (end_p + search_str_size <= current_p
        && memcmp (end_p, search_str_utf8_p, search_str_size) == 0)
    {
      ret_value = position;
      break;
    }

    if (position == 0)
    {
      break;
    }

    lit_utf8_decr (&end_p);
    position--;
  }

  ECMA_FINALIZE_UTF8_STRING (original_str_utf8_p, original_str_size);
  ECMA_FINALIZE_UTF8_STRING (search_str_utf8_p, search_str_size);

  return ret_value;
} /* ecma_builtin_helper_string_find_last_index */

/**
 * Helper function for string indexOf, lastIndexOf, startsWith, includes, endsWith functions
 *
 * See also:
 *          ECMA-262 v5, 15.5.4.7
 *          ECMA-262 v5, 15.5.4.8
 *          ECMA-262 v6, 21.1.3.6
 *          ECMA-262 v6, 21.1.3.7
 *          ECMA-262 v6, 21.1.3.18
 *
 * Used by:
 *         - The String.prototype.indexOf routine.
 *         - The String.prototype.lastIndexOf routine.
 *         - The String.prototype.startsWith routine.
 *         - The String.prototype.includes routine.
 *         - The String.prototype.endsWith routine.
 *
 * @return ecma_value_t - Returns index (last index) or a

Review comment (suggestion):
The main logic could be enclosed in an `if (original_str_size >= search_str_size)` block, otherwise there's no need to search through the string.

Code after:

  if (original_str_size >= search_str_size)
  {
    const lit_utf8_byte_t *end_p = original_str_utf8_p + original_str_size;
    const lit_utf8_byte_t *current_p = end_p;

    for (ecma_number_t i = original_length; i > position; i--)
    {
      lit_utf8_decr (&current_p);
    }

    while (current_p + search_str_size > end_p)
    {
      lit_utf8_decr (&current_p);
      position--;
    }

    while (true)
    {
      if (memcmp (current_p, search_str_utf8_p, search_str_size) == 0)
      {
        ret_value = position;
        break;
      }

      if (position == 0)
      {
        break;
      }

      lit_utf8_decr (&current_p);
      position--;
    }
  }
  ECMA_FINALIZE_UTF8_STRING (original_str_utf8_p, original_str_size);
  ECMA_FINALIZE_UTF8_STRING (search_str_utf8_p, search_str_size);

  return ret_value;
} /* ecma_builtin_helper_string_find_last_index */

/**
 * Helper function for string indexOf, lastIndexOf, startsWith, includes, endsWith functions
 *
 * See also:
 *          ECMA-262 v5, 15.5.4.7
 *          ECMA-262 v5, 15.5.4.8
 *          ECMA-262 v6, 21.1.3.6
 *          ECMA-262 v6, 21.1.3.7
 *          ECMA-262 v6, 21.1.3.18
 *
 * Used by:
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c (C)

Code before:
                                            ecma_string_t *search_str_p, /**< search string */
                                            uint32_t position) /**< start_position */
{
  if (ecma_string_is_empty (search_str_p))
  {
    return position;
  }

  uint32_t original_length = ecma_string_get_length (original_str_p);

  ECMA_STRING_TO_UTF8_STRING (search_str_p, search_str_utf8_p, search_str_size);
  ECMA_STRING_TO_UTF8_STRING (original_str_p, original_str_utf8_p, original_str_size);

  const lit_utf8_byte_t *end_p = original_str_utf8_p + original_str_size;
  const lit_utf8_byte_t  *current_p = end_p;

  for (ecma_number_t i = original_length; i > position; i--)
  {
    lit_utf8_decr (&end_p);
  }

  uint32_t ret_value = UINT32_MAX;

  while (true)
  {
    if (end_p + search_str_size <= current_p
        && memcmp (end_p, search_str_utf8_p, search_str_size) == 0)
    {
      ret_value = position;
      break;
    }

    if (position == 0)
    {
      break;
    }

    lit_utf8_decr (&end_p);
    position--;
  }

  ECMA_FINALIZE_UTF8_STRING (original_str_utf8_p, original_str_size);
  ECMA_FINALIZE_UTF8_STRING (search_str_utf8_p, search_str_size);

  return ret_value;
} /* ecma_builtin_helper_string_find_last_index */

/**
 * Helper function for string indexOf, lastIndexOf, startsWith, includes, endsWith functions
 *
 * See also:

Review comment (suggestion):
This first part of the condition could be removed, if you further adjust the starting search position before the main while loop.

```c
while (current_p + search_str_size > end_p)
{
  lit_utf8_decr (&current_p)
  position--;
}
```


Code after:
                                            ecma_string_t *search_str_p, /**< search string */
                                            uint32_t position) /**< start_position */
{
  if (ecma_string_is_empty (search_str_p))
  {
    return position;
  }

  uint32_t original_length = ecma_string_get_length (original_str_p);

  ECMA_STRING_TO_UTF8_STRING (search_str_p, search_str_utf8_p, search_str_size);
  ECMA_STRING_TO_UTF8_STRING (original_str_p, original_str_utf8_p, original_str_size);

  uint32_t ret_value = UINT32_MAX;

  if (original_str_size >= search_str_size)
  {
    const lit_utf8_byte_t *end_p = original_str_utf8_p + original_str_size;
    const lit_utf8_byte_t *current_p = end_p;

    for (ecma_number_t i = original_length; i > position; i--)
    {
      lit_utf8_decr (&current_p);
    }

    while (current_p + search_str_size > end_p)
    {
      lit_utf8_decr (&current_p);
      position--;
    }

    while (true)
    {
      if (memcmp (current_p, search_str_utf8_p, search_str_size) == 0)
      {
        ret_value = position;
        break;
      }

      if (position == 0)
      {
        break;
      }

      lit_utf8_decr (&current_p);
      position--;
    }
  }
  ECMA_FINALIZE_UTF8_STRING (original_str_utf8_p, original_str_size);
  ECMA_FINALIZE_UTF8_STRING (search_str_utf8_p, search_str_size);
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c (C)

Code before:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_IGNORE_CASE:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_MULTILINE:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE:
    {
      if (!ecma_object_is_regexp_object (this_arg))
      {
        return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a RegExp object"));
      }

      uint16_t flags = RE_FLAG_EMPTY;
      ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;

      ecma_value_t ret_value = ecma_builtin_regexp_prototype_flags_helper (re_obj_p, &flags);
      if (ECMA_IS_VALUE_ERROR (ret_value))
      {
        return ret_value;
      }

      static const uint16_t re_flags[] =
      {
        RE_FLAG_GLOBAL, RE_FLAG_IGNORE_CASE,
        RE_FLAG_MULTILINE, RE_FLAG_STICKY, RE_FLAG_UNICODE
      };
      uint16_t padded_index = (uint16_t) (builtin_routine_id - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL);
      return ecma_make_boolean_value (flags & re_flags[padded_index]);
    }
#endif /* ENABLED (JERRY_ESNEXT) */
    default:
    {
      JERRY_UNREACHABLE ();
    }
  }
} /* ecma_builtin_regexp_prototype_dispatch_routine */
/**
 * @}
 * @}
 * @}
 */

#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */


Review comment (refactor):
I'd move this flag -> boolean login into `ecma_builtin_regexp_prototype_flags_helper`.

Code after:
    {
      return ecma_regexp_split_helper (this_arg, arguments_list_p[0], arguments_list_p[1]);
    }
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS:
    {
      return ecma_builtin_regexp_prototype_get_flags (obj_p);
    }
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE:
    {
      ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;

      return ecma_builtin_regexp_prototype_get_source (re_obj_p);
    }
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_IGNORE_CASE:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_MULTILINE:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY:
    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE:
    {
      ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;

      return ecma_builtin_regexp_prototype_flags_helper (re_obj_p, builtin_routine_id);
    }
#endif /* ENABLED (JERRY_ESNEXT) */
    default:
    {
      JERRY_UNREACHABLE ();
    }
  }
} /* ecma_builtin_regexp_prototype_dispatch_routine */
/**
 * @}
 * @}
 * @}
 */

#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */