Add property key filters for built-in functions (#4776)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -105,29 +105,36 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
void
|
||||
ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p, /**< a String object */
|
||||
ecma_collection_t *prop_names_p, /**< prop name collection */
|
||||
ecma_property_counter_t *prop_counter_p) /**< prop counter */
|
||||
ecma_property_counter_t *prop_counter_p, /**< property counters */
|
||||
jerry_property_filter_t filter) /**< property name filter options */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_base_type (obj_p) == ECMA_OBJECT_BASE_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
JERRY_ASSERT (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_STRING);
|
||||
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (ext_object_p->u.cls.u3.value);
|
||||
|
||||
lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);
|
||||
|
||||
for (lit_utf8_size_t i = 0; i < length; i++)
|
||||
if (!(filter & JERRY_PROPERTY_FILTER_EXLCUDE_INTEGER_INDICES))
|
||||
{
|
||||
ecma_string_t *name_p = ecma_new_ecma_string_from_uint32 (i);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
JERRY_ASSERT (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_STRING);
|
||||
|
||||
/* the properties are enumerable (ECMA-262 v5, 15.5.5.2.9) */
|
||||
ecma_collection_push_back (prop_names_p, ecma_make_string_value (name_p));
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (ext_object_p->u.cls.u3.value);
|
||||
|
||||
lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);
|
||||
|
||||
for (lit_utf8_size_t i = 0; i < length; i++)
|
||||
{
|
||||
ecma_string_t *name_p = ecma_new_ecma_string_from_uint32 (i);
|
||||
|
||||
/* the properties are enumerable (ECMA-262 v5, 15.5.5.2.9) */
|
||||
ecma_collection_push_back (prop_names_p, ecma_make_string_value (name_p));
|
||||
}
|
||||
|
||||
prop_counter_p->array_index_named_props += length;
|
||||
}
|
||||
|
||||
prop_counter_p->array_index_named_props += length;
|
||||
|
||||
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
|
||||
prop_counter_p->string_named_props++;
|
||||
if (!(filter & JERRY_PROPERTY_FILTER_EXLCUDE_STRINGS))
|
||||
{
|
||||
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
|
||||
prop_counter_p->string_named_props++;
|
||||
}
|
||||
} /* ecma_op_string_list_lazy_property_names */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user