ronantakizawa/codereview-bench huggingface dataset:
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c (C)

Code before:
      break;
    }
#if ENABLED (JERRY_BUILTIN_REGEXP)
    case ECMA_STRING_PROTOTYPE_REPLACE:
    {
      ret_value = ecma_builtin_string_prototype_object_replace (to_string_val, arg1, arg2);
      break;
    }
    case ECMA_STRING_PROTOTYPE_SEARCH:
    {
      ret_value = ecma_builtin_string_prototype_object_search (to_string_val, arg1);
      break;
    }
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
    case ECMA_STRING_PROTOTYPE_SPLIT:
    {
      ret_value = ecma_builtin_string_prototype_object_split (to_string_val, arg1, arg2);
      break;
    }
    case ECMA_STRING_PROTOTYPE_SUBSTRING:
    {
      ret_value = ecma_builtin_string_prototype_object_substring (string_p, arg1, arg2);
      break;
    }
    case ECMA_STRING_PROTOTYPE_TO_LOWER_CASE:
    case ECMA_STRING_PROTOTYPE_TO_LOCAL_LOWER_CASE:
    case ECMA_STRING_PROTOTYPE_TO_UPPER_CASE:
    case ECMA_STRING_PROTOTYPE_TO_LOCAL_UPPER_CASE:
    {
      bool is_lower_case = builtin_routine_id <= ECMA_STRING_PROTOTYPE_TO_LOCAL_LOWER_CASE;
      ret_value = ecma_builtin_string_prototype_object_conversion_helper (string_p, is_lower_case);
      break;
    }
    case ECMA_STRING_PROTOTYPE_TRIM:
    {
      ret_value = ecma_builtin_string_prototype_object_trim (string_p);
      break;
    }
#if ENABLED (JERRY_BUILTIN_ANNEXB)
    case ECMA_STRING_PROTOTYPE_SUBSTR:
    {
      ret_value = ecma_builtin_string_prototype_object_substr (string_p, arg1, arg2);
      break;
    }
#endif /* ENABLED (JERRY_BUILTIN_ANNEXB) */
#if ENABLED (JERRY_ESNEXT)
    case ECMA_STRING_PROTOTYPE_REPEAT:
    {
      ret_value = ecma_builtin_string_prototype_object_repeat (string_p, arg1);
      break;
    }

Review comment (suggestion):
Combine `ECMA_STRING_PROTOTYPE_PAD_END` with `ECMA_STRING_PROTOTYPE_PAD_START` and call directly `ecma_string_pad`.

Code after:
      break;
    }
#if ENABLED (JERRY_BUILTIN_ANNEXB)
    case ECMA_STRING_PROTOTYPE_SUBSTR:
    {
      ret_value = ecma_builtin_string_prototype_object_substr (string_p, arg1, arg2);
      break;
    }
#endif /* ENABLED (JERRY_BUILTIN_ANNEXB) */
#if ENABLED (JERRY_ESNEXT)
    case ECMA_STRING_PROTOTYPE_REPEAT:
    {
      ret_value = ecma_builtin_string_prototype_object_repeat (string_p, arg1);
      break;
    }
    case ECMA_STRING_PROTOTYPE_CODE_POINT_AT:
    {
      ret_value = ecma_builtin_string_prototype_object_code_point_at (string_p, arg1);
      break;
    }
    case ECMA_STRING_PROTOTYPE_ITERATOR:
    {
      ret_value = ecma_builtin_string_prototype_object_iterator (to_string_val);
      break;
    }
    case ECMA_STRING_PROTOTYPE_PAD_END:
    case ECMA_STRING_PROTOTYPE_PAD_START:
    {
      ret_value = ecma_string_pad (to_string_val, arg1, arg2, builtin_routine_id == ECMA_STRING_PROTOTYPE_PAD_START);
      break;
    }
#endif /* ENABLED (JERRY_ESNEXT) */
    default:
    {
      JERRY_UNREACHABLE ();
    }
  }

  ecma_deref_ecma_string (string_p);

  return ret_value;
} /* ecma_builtin_string_prototype_dispatch_routine */

/**
 * @}
 * @}
 * @}
 */

#endif /* ENABLED (JERRY_BUILTIN_STRING) */
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-regexp-object.c (C)

Code before:

        goto fail;

class_found:
        if (flags & RE_CLASS_INVERT)
        {
          goto fail;
        }

        const uint32_t chars_size = char_count * re_ctx_p->char_size;
        const uint32_t ranges_size = range_count * re_ctx_p->char_size * 2;
        bc_p = bc_p + escape_count + chars_size + ranges_size;
        continue;
      }
#if ENABLED (JERRY_ESNEXT)
      case RE_OP_UNICODE_PERIOD:
      {
        if (str_curr_p >= re_ctx_p->input_end_p)
        {
          goto fail;
        }

        const lit_code_point_t cp = ecma_regexp_unicode_advance (&str_curr_p, re_ctx_p->input_end_p);

        if (JERRY_UNLIKELY (!(re_ctx_p->flags & RE_FLAG_DOTALL) && cp <= LIT_UTF16_CODE_UNIT_MAX &&
            lit_char_is_line_terminator ((ecma_char_t) cp)))
        {
          goto fail;
        }
        continue;
      }
#endif /* ENABLED (JERRY_ESNEXT) */
      case RE_OP_PERIOD:
      {
        if (str_curr_p >= re_ctx_p->input_end_p)
        {
          goto fail;
        }

        const ecma_char_t ch = lit_cesu8_read_next (&str_curr_p);
#if !ENABLED (JERRY_ESNEXT)
        bool has_dot_all_flag = false;
#else /* ENABLED (JERRY_ESNEXT) */
        bool has_dot_all_flag = (re_ctx_p->flags & RE_FLAG_DOTALL) != 0;
#endif /* !ENABLED (JERRY_ESNEXT) */
        if (!has_dot_all_flag && lit_char_is_line_terminator (ch))
        {
          goto fail;
        }

        continue;

Review comment (suggestion):
```c
if (!(re_ctx_p->flags & RE_FLAG_DOTALL)
    && JERRY_UNLIKELY (cp <= LIT_UTF16_CODE_UNIT_MAX 
                       && lit_char_is_line_terminator ((ecma_char_t) cp)))
```

Code after:

        goto fail;

class_found:
        if (flags & RE_CLASS_INVERT)
        {
          goto fail;
        }

        const uint32_t chars_size = char_count * re_ctx_p->char_size;
        const uint32_t ranges_size = range_count * re_ctx_p->char_size * 2;
        bc_p = bc_p + escape_count + chars_size + ranges_size;
        continue;
      }
#if ENABLED (JERRY_ESNEXT)
      case RE_OP_UNICODE_PERIOD:
      {
        if (str_curr_p >= re_ctx_p->input_end_p)
        {
          goto fail;
        }

        const lit_code_point_t cp = ecma_regexp_unicode_advance (&str_curr_p, re_ctx_p->input_end_p);

        if (!(re_ctx_p->flags & RE_FLAG_DOTALL)
            && JERRY_UNLIKELY (cp <= LIT_UTF16_CODE_UNIT_MAX
                               && lit_char_is_line_terminator ((ecma_char_t) cp)))
        {
          goto fail;
        }

        continue;
      }
#endif /* ENABLED (JERRY_ESNEXT) */
      case RE_OP_PERIOD:
      {
        if (str_curr_p >= re_ctx_p->input_end_p)
        {
          goto fail;
        }

        const ecma_char_t ch = lit_cesu8_read_next (&str_curr_p);
#if !ENABLED (JERRY_ESNEXT)
        bool has_dot_all_flag = false;
#else /* ENABLED (JERRY_ESNEXT) */
        bool has_dot_all_flag = (re_ctx_p->flags & RE_FLAG_DOTALL) != 0;
#endif /* !ENABLED (JERRY_ESNEXT) */

        if (!has_dot_all_flag && lit_char_is_line_terminator (ch))
        {
          goto fail;
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-helpers-sort.c (C)

Code before:
    else
    {
      array_b_p[k] = array_a_p[j];
      j++;
    }
    ecma_free_value (compare_value);
  }

  return ret_value;
} /* ecma_builtin_helper_array_merge_sort_bottom_up */

/**
 * Mergesort function
 *
 * @return ecma value
 *         Returned value must be freed with ecma_free_value.
 */
ecma_value_t
ecma_builtin_helper_array_merge_sort_helper (ecma_value_t *array_p, /**< array to sort */
                                             uint32_t length, /**< length */
                                             ecma_value_t compare_func, /**< compare function */
                                             const ecma_builtin_helper_sort_compare_fn_t sort_cb) /**< sorting cb */
{
  // create array copy
  ecma_value_t ret_value = ECMA_VALUE_EMPTY;
  JMEM_DEFINE_LOCAL_ARRAY (array_copy_p, length, ecma_value_t);

  uint32_t index = 0;

  while (index < length)
  {
    array_copy_p[index] = array_p[index];
    index++;
  }

  JERRY_ASSERT (index == length);

  ecma_value_t *temp_p;
  ecma_value_t *base_array_p = array_p;
  uint32_t r, e;
  for (uint32_t w = 1; w < length; w = 2 * w)
  {
    for (uint32_t i = 0; i < length; i = i + 2 * w)
    {
      // End of first array
      r = i + w;
      if (r > length)
      {
        r = length;
      }


Review comment (suggestion):
Could we also choose a more suitable name for this, something like `dest_array_p` or `result_array_p`, since it will contain the result of the last iteration.

Code after:
    else
    {
      output_array_p[k] = source_array_p[j];
      j++;
    }
    ecma_free_value (compare_value);
  }

  return ret_value;
} /* ecma_builtin_helper_array_merge_sort_bottom_up */

/**
 * Mergesort function
 *
 * @return ecma value
 *         Returned value must be freed with ecma_free_value.
 */
ecma_value_t
ecma_builtin_helper_array_merge_sort_helper (ecma_value_t *array_p, /**< array to sort */
                                             uint32_t length, /**< length */
                                             ecma_value_t compare_func, /**< compare function */
                                             const ecma_builtin_helper_sort_compare_fn_t sort_cb) /**< sorting cb */
{
  ecma_value_t ret_value = ECMA_VALUE_EMPTY;
  JMEM_DEFINE_LOCAL_ARRAY (dest_array_p, length, ecma_value_t);

  ecma_value_t *temp_p;
  ecma_value_t *base_array_p = array_p;
  uint32_t r, e;

  for (uint32_t w = 1; w < length; w = 2 * w)
  {
    for (uint32_t i = 0; i < length; i = i + 2 * w)
    {
      // End of first array
      r = i + w;
      if (r > length)
      {
        r = length;
      }

      // End of second array
      e = i + 2 * w;
      if (e > length)
      {
        e = length;
      }

      // Merge two arrays
      ret_value = ecma_builtin_helper_array_merge_sort_bottom_up (array_p,
                                                                  i,
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-array-object.c (C)

Code before:
      else
      {
        prev_prop_p->next_property_cp = current_prop_p->next_property_cp;
      }

      jmem_cpointer_t next_prop_cp = current_prop_p->next_property_cp;
      ecma_dealloc_property_pair ((ecma_property_pair_t *) current_prop_p);
      current_prop_cp = next_prop_cp;
    }
    else
    {
      prev_prop_p = current_prop_p;
      current_prop_cp = current_prop_p->next_property_cp;
    }
  }

#if ENABLED (JERRY_PROPRETY_HASHMAP)
  if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP)
  {
    ecma_property_hashmap_free (object_p);
    ecma_property_hashmap_create (object_p);
  }
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */

  return new_length;
} /* ecma_delete_array_properties */

/**
 * Update the length of an array to a new length
 *
 * @return ecma value
 *         Returned value must be freed with ecma_free_value
 */
ecma_value_t
ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object */
                                 ecma_value_t new_value, /**< new length value */
                                 uint32_t flags) /**< configuration options */
{
  bool is_throw = (flags & ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_IS_THROW);
  ecma_number_t new_len_num;
  ecma_value_t completion = ecma_op_to_number (new_value, &new_len_num);

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

  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (completion));

  ecma_free_value (completion);


Review comment (suggestion):
This entire `if (ecma_is_value_object (new_value))` block is not necessary, the previous ecma_op_to_number will already handle objects.

Code after:

/**
 * Update the length of an array to a new length
 *
 * @return ecma value
 *         Returned value must be freed with ecma_free_value
 */
ecma_value_t
ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object */
                                 ecma_value_t new_value, /**< new length value */
                                 uint32_t flags) /**< configuration options */
{
  bool is_throw = (flags & ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_IS_THROW);
  ecma_number_t new_len_num;
  ecma_value_t completion = ecma_op_to_number (new_value, &new_len_num);

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

  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (completion));

  if (ecma_is_value_object (new_value))
  {
    ecma_value_t compared_num_val = ecma_op_to_number (new_value, &new_len_num);

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

  uint32_t new_len_uint32 = ecma_number_to_uint32 (new_len_num);

  if (((ecma_number_t) new_len_uint32) != new_len_num)
  {
    return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid array length."));
  }

  if (flags & ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_REJECT)
  {
    return ecma_reject (is_throw);
  }

  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;

  uint32_t old_len_uint32 = ext_object_p->u.array.length;

  if (new_len_num == old_len_uint32)
  {
Repository: jerryscript-project/jerryscript
File: jerry-core/api/jerry.c (C)

Code before:
} /* jerry_value_to_boolean */

/**
 * Call ToNumber operation on the api value.
 *
 * Note:
 *      returned value must be freed with jerry_release_value, when it is no longer needed.
 *
 * @return converted number value - if success
 *         thrown error - otherwise
 */
jerry_value_t
jerry_value_to_number (const jerry_value_t value) /**< input value */
{
  jerry_assert_api_available ();

  if (ecma_is_value_error_reference (value))
  {
    return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
  }

  ecma_number_t num;
  ecma_value_t ret_value = ecma_op_to_number (value, &num);
  if (ECMA_IS_VALUE_ERROR (ret_value))
  {
    return ret_value;
  }
  return jerry_return (ecma_make_number_value (num));
} /* jerry_value_to_number */

/**
 * Call ToObject operation on the api value.
 *
 * Note:
 *      returned value must be freed with jerry_release_value, when it is no longer needed.
 *
 * @return converted object value - if success
 *         thrown error - otherwise
 */
jerry_value_t
jerry_value_to_object (const jerry_value_t value) /**< input value */
{
  jerry_assert_api_available ();

  if (ecma_is_value_error_reference (value))
  {
    return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
  }

  return jerry_return (ecma_op_to_object (value));
} /* jerry_value_to_object */

Review comment (suggestion):
`return ecma_create_error_reference_from_context ()`

Code after:
 * @return stored number as double
 */
double
jerry_get_number_value (const jerry_value_t value) /**< api value */
{
  jerry_assert_api_available ();

  if (!ecma_is_value_number (value))
  {
    return 0;
  }

  return (double) ecma_get_number_from_value (value);
} /* jerry_get_number_value */

/**
 * Call ToBoolean operation on the api value.
 *
 * @return true  - if the logical value is true
 *         false - otherwise
 */
bool
jerry_value_to_boolean (const jerry_value_t value) /**< input value */
{
  jerry_assert_api_available ();

  if (ecma_is_value_error_reference (value))
  {
    return false;
  }

  return ecma_op_to_boolean (value);
} /* jerry_value_to_boolean */

/**
 * Call ToNumber operation on the api value.
 *
 * Note:
 *      returned value must be freed with jerry_release_value, when it is no longer needed.
 *
 * @return converted number value - if success
 *         thrown error - otherwise
 */
jerry_value_t
jerry_value_to_number (const jerry_value_t value) /**< input value */
{
  jerry_assert_api_available ();

  if (ecma_is_value_error_reference (value))
  {
    return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/base/ecma-helpers-number.c (C)

Code before:
  ecma_char_t current = lit_cesu8_read_next (&string_curr_p);
  if (current == LIT_CHAR_MINUS)
  {
    sign = -1;
  }

  /* 5. */
  if (current == LIT_CHAR_MINUS || current == LIT_CHAR_PLUS)
  {
    start_p = string_curr_p;
    if (string_curr_p < string_end_p)
    {
      current = lit_cesu8_read_next (&string_curr_p);
    }
  }

  /* 6. */
  ecma_number_t radix_num;
  radix = ecma_op_to_number (radix, &radix_num);

  if (!ecma_is_value_empty (radix))
  {
    return radix;
  }

  int32_t rad = ecma_number_to_int32 (radix_num);

  /* 7.*/
  bool strip_prefix = true;

  /* 8. */
  if (rad != 0)
  {
    /* 8.a */
    if (rad < 2 || rad > 36)
    {
      return ecma_make_nan_value ();
    }
    /* 8.b */
    else if (rad != 16)
    {
      strip_prefix = false;
    }
  }
  /* 9. */
  else
  {
    rad = 10;
  }

  /* 10. */

Review comment (suggestion):
```c
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (radix, &radix_num)))
{
  return ECMA_VALUER_ERROR;
}
```

Code after:
  {
    sign = -1;
  }

  /* 5. */
  if (current == LIT_CHAR_MINUS || current == LIT_CHAR_PLUS)
  {
    start_p = string_curr_p;
    if (string_curr_p < string_end_p)
    {
      current = lit_cesu8_read_next (&string_curr_p);
    }
  }

  /* 6. */
  ecma_number_t radix_num;
  radix = ecma_op_to_number (radix, &radix_num);

  if (ECMA_IS_VALUE_ERROR (radix))
  {
    return ECMA_VALUE_ERROR;
  }

  int32_t rad = ecma_number_to_int32 (radix_num);

  /* 7.*/
  bool strip_prefix = true;

  /* 8. */
  if (rad != 0)
  {
    /* 8.a */
    if (rad < 2 || rad > 36)
    {
      return ecma_make_nan_value ();
    }
    /* 8.b */
    else if (rad != 16)
    {
      strip_prefix = false;
    }
  }
  /* 9. */
  else
  {
    rad = 10;
  }

  /* 10. */
  if (strip_prefix
      && ((end_p - start_p) >= 2)
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/base/ecma-helpers-number.c (C)

Code before:
  if (string_curr_p >= string_end_p)
  {
    return ecma_make_nan_value ();
  }

  /* 3. */
  int sign = 1;

  /* 4. */
  ecma_char_t current = lit_cesu8_read_next (&string_curr_p);
  if (current == LIT_CHAR_MINUS)
  {
    sign = -1;
  }

  /* 5. */
  if (current == LIT_CHAR_MINUS || current == LIT_CHAR_PLUS)
  {
    start_p = string_curr_p;
    if (string_curr_p < string_end_p)
    {
      current = lit_cesu8_read_next (&string_curr_p);
    }
  }

  /* 6. */
  ecma_number_t radix_num;
  radix = ecma_op_to_number (radix, &radix_num);

  if (ECMA_IS_VALUE_ERROR (radix))
  {
    return ECMA_VALUE_ERROR;
  }

  if (!ecma_is_value_empty (radix))
  {
    return radix;
  }

  int32_t rad = ecma_number_to_int32 (radix_num);

  /* 7.*/
  bool strip_prefix = true;

  /* 8. */
  if (rad != 0)
  {
    /* 8.a */
    if (rad < 2 || rad > 36)
    {
      return ecma_make_nan_value ();

Review comment (suggestion):
The result of this is checked twice, on line 770 and on line 775. We should apply @rerobika's suggestion:
> ```c
> if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (radix, &radix_num)))
> {
>   return ECMA_VALUER_ERROR;
> }
> ```


Code after:
    return ecma_make_nan_value ();
  }

  /* 3. */
  int sign = 1;

  /* 4. */
  ecma_char_t current = lit_cesu8_read_next (&string_curr_p);
  if (current == LIT_CHAR_MINUS)
  {
    sign = -1;
  }

  /* 5. */
  if (current == LIT_CHAR_MINUS || current == LIT_CHAR_PLUS)
  {
    start_p = string_curr_p;
    if (string_curr_p < string_end_p)
    {
      current = lit_cesu8_read_next (&string_curr_p);
    }
  }

  /* 6. */
  ecma_number_t radix_num;
  radix = ecma_op_to_number (radix, &radix_num);

  if (ECMA_IS_VALUE_ERROR (radix))
  {
    return ECMA_VALUE_ERROR;
  }

  int32_t rad = ecma_number_to_int32 (radix_num);

  /* 7.*/
  bool strip_prefix = true;

  /* 8. */
  if (rad != 0)
  {
    /* 8.a */
    if (rad < 2 || rad > 36)
    {
      return ecma_make_nan_value ();
    }
    /* 8.b */
    else if (rad != 16)
    {
      strip_prefix = false;
    }
  }
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-conversion.c (C)

Code before:
        && (prop_desc.flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED)))
  {
    ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Accessors cannot be writable."));
  }
  else
  {
    *out_prop_desc_p = prop_desc;
    ret_value = ECMA_VALUE_EMPTY;
  }

free_desc:
  if (ECMA_IS_VALUE_ERROR (ret_value))
  {
    ecma_free_property_descriptor (&prop_desc);
  }

  return ret_value;
} /* ecma_op_to_property_descriptor */
/**
 * IsInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return true if the argument is
 *         integer false otherwise
 */
ecma_value_t
ecma_is_integer (ecma_number_t value) /**< ecma value */
{

  if (ecma_number_is_nan (value) || ecma_number_is_infinity (value))
  {
    return ECMA_VALUE_FALSE;
  }

  ecma_number_t floor_fabs = floor (fabs (value));
  ecma_number_t fabs_value = fabs (value);

  return ecma_make_boolean_value (floor_fabs == fabs_value);
} /* ecma_is_integer*/
/**
 * ToInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return ECMA_VALUE_EMPTY if successful
 *         conversion error otherwise

Review comment (suggestion):
```
@return true - if the argument is integer
              false - otherwise
```

Code after:
        && (prop_desc.flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED)))
  {
    ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Accessors cannot be writable."));
  }
  else
  {
    *out_prop_desc_p = prop_desc;
    ret_value = ECMA_VALUE_EMPTY;
  }

free_desc:
  if (ECMA_IS_VALUE_ERROR (ret_value))
  {
    ecma_free_property_descriptor (&prop_desc);
  }

  return ret_value;
} /* ecma_op_to_property_descriptor */

/**
 * IsInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return true - if the argument is integer
 *              false - otherwise
 */
bool
ecma_op_is_integer (ecma_number_t num) /**< ecma number */
{

  if (ecma_number_is_nan (num) || ecma_number_is_infinity (num))
  {
    return false;
  }

  ecma_number_t floor_fabs = floor (fabs (num));
  ecma_number_t fabs_value = fabs (num);

  return (floor_fabs == fabs_value);
} /* ecma_op_is_integer*/
/**
 * ToInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return ECMA_VALUE_EMPTY if successful
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-conversion.c (C)

Code before:
  else
  {
    *out_prop_desc_p = prop_desc;
    ret_value = ECMA_VALUE_EMPTY;
  }

free_desc:
  if (ECMA_IS_VALUE_ERROR (ret_value))
  {
    ecma_free_property_descriptor (&prop_desc);
  }

  return ret_value;
} /* ecma_op_to_property_descriptor */
/**
 * IsInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return true if the argument is
 *         integer false otherwise
 */
ecma_value_t
ecma_is_integer (ecma_number_t value) /**< ecma value */
{

  if (ecma_number_is_nan (value) || ecma_number_is_infinity (value))
  {
    return ECMA_VALUE_FALSE;
  }

  ecma_number_t floor_fabs = floor (fabs (value));
  ecma_number_t fabs_value = fabs (value);

  return ecma_make_boolean_value (floor_fabs == fabs_value);
} /* ecma_is_integer*/
/**
 * ToInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return ECMA_VALUE_EMPTY if successful
 *         conversion error otherwise
 */
ecma_value_t
ecma_op_to_integer (ecma_value_t value, /**< ecma value */
                    ecma_number_t *number_p) /**< [out] ecma number */

Review comment (suggestion):
`ecma_is_integer` -> `ecma_op_is_integer`

`(ecma_number_t value) /**< ecma value */` -> `(ecma_number_t num) /**< ecma number */`

Code after:
  else
  {
    *out_prop_desc_p = prop_desc;
    ret_value = ECMA_VALUE_EMPTY;
  }

free_desc:
  if (ECMA_IS_VALUE_ERROR (ret_value))
  {
    ecma_free_property_descriptor (&prop_desc);
  }

  return ret_value;
} /* ecma_op_to_property_descriptor */

/**
 * IsInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return true - if the argument is integer
 *              false - otherwise
 */
bool
ecma_op_is_integer (ecma_number_t num) /**< ecma number */
{

  if (ecma_number_is_nan (num) || ecma_number_is_infinity (num))
  {
    return false;
  }

  ecma_number_t floor_fabs = floor (fabs (num));
  ecma_number_t fabs_value = fabs (num);

  return (floor_fabs == fabs_value);
} /* ecma_op_is_integer*/
/**
 * ToInteger operation.
 *
 * See also:
 *          ECMA-262 v5, 9.4
 *          ECMA-262 v6, 7.1.4
 *
 * @return ECMA_VALUE_EMPTY if successful
 *         conversion error otherwise
 */
ecma_value_t
ecma_op_to_integer (ecma_value_t value, /**< ecma value */