Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtins.c (C)

Code before:
  {
    ecma_property_value_t *prop_value_p = ecma_create_named_data_property (object_p,
                                                                           string_p,
                                                                           curr_property_p->attributes,
                                                                           &prop_p);
    prop_value_p->value = value;

    /* Reference count of objects must be decreased. */
    if (ecma_is_value_object (value))
    {
      ecma_free_value (value);
    }
  }

  return prop_p;
} /* ecma_builtin_try_to_instantiate_property */

/**
 * List names of a built-in object's lazy instantiated properties
 *
 * See also:
 *          ecma_builtin_try_to_instantiate_property
 */
void
ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in object */
                                       uint32_t opts, /**< listing options */
                                       ecma_collection_t *main_collection_p, /**< 'main' collection */
                                       ecma_collection_t *non_enum_collection_p) /**< skipped 'non-enumerable'
                                                                                  *   collection */
{
  JERRY_ASSERT (ecma_get_object_is_builtin (object_p));

  const bool separate_enumerable = (opts & ECMA_LIST_ENUMERABLE) != 0;
  const bool is_array_indices_only = (opts & ECMA_LIST_ARRAY_INDICES) != 0;

  if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION
      && ecma_builtin_function_is_routine (object_p))
  {
    ecma_collection_t *for_enumerable_p = main_collection_p;
    JERRY_UNUSED (for_enumerable_p);

    ecma_collection_t *for_non_enumerable_p = separate_enumerable ? non_enum_collection_p : main_collection_p;

    /* 'length' property is non-enumerable (ECMA-262 v5, 15) */
    ecma_collection_push_back (for_non_enumerable_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
  }
  else
  {
    ecma_built_in_props_t *built_in_props_p;
    ecma_object_type_t object_type = ecma_get_object_type (object_p);


Review comment (suggestion):
Could we update the comment to reference the `ecma_list_properties_options_t` enum?
like: `uint32_t opts, /**< listing options using flags from ecma_list_properties_options_t */`

or maybe we should just mention it at the method's comments? What do you think?
(btw: this also applies to the other places where the `opts` is used)

Code after:
  {
    ecma_property_value_t *prop_value_p = ecma_create_named_data_property (object_p,
                                                                           string_p,
                                                                           curr_property_p->attributes,
                                                                           &prop_p);
    prop_value_p->value = value;

    /* Reference count of objects must be decreased. */
    if (ecma_is_value_object (value))
    {
      ecma_free_value (value);
    }
  }

  return prop_p;
} /* ecma_builtin_try_to_instantiate_property */

/**
 * List names of a built-in object's lazy instantiated properties
 *
 * See also:
 *          ecma_builtin_try_to_instantiate_property
 */
void
ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in object */
                                       uint32_t opts, /**< listing options using flags
                                                       *   from ecma_list_properties_options_t */
                                       ecma_collection_t *main_collection_p, /**< 'main' collection */
                                       ecma_collection_t *non_enum_collection_p) /**< skipped 'non-enumerable'
                                                                                  *   collection */
{
  JERRY_ASSERT (ecma_get_object_is_builtin (object_p));

  const bool separate_enumerable = (opts & ECMA_LIST_ENUMERABLE) != 0;
  const bool is_array_indices_only = (opts & ECMA_LIST_ARRAY_INDICES) != 0;

  if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION
      && ecma_builtin_function_is_routine (object_p))
  {
    ecma_collection_t *for_enumerable_p = main_collection_p;
    JERRY_UNUSED (for_enumerable_p);

    ecma_collection_t *for_non_enumerable_p = separate_enumerable ? non_enum_collection_p : main_collection_p;

    /* 'length' property is non-enumerable (ECMA-262 v5, 15) */
    ecma_collection_push_back (for_non_enumerable_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
  }
  else
  {
    ecma_built_in_props_t *built_in_props_p;
    ecma_object_type_t object_type = ecma_get_object_type (object_p);