Iterators for ecma-values collections

This commit is contained in:
Ruben Ayrapetyan
2014-08-15 15:58:34 +04:00
parent cf098ad4ac
commit 2a199cc6a7
3 changed files with 80 additions and 24 deletions
+20 -2
View File
@@ -106,6 +106,26 @@ extern ecma_collection_header_t *ecma_new_values_collection (ecma_value_t values
extern void ecma_free_values_collection (ecma_collection_header_t* header_p, bool do_deref_if_object);
extern ecma_collection_header_t *ecma_new_strings_collection (ecma_string_t* string_ptrs_buffer[],
ecma_length_t strings_number);
/**
* Context of ecma-values' collection iterator
*/
typedef struct
{
ecma_collection_header_t *header_p; /**< collection header */
uint16_t next_chunk_cp; /**< compressed pointer to next chunk */
ecma_length_t current_index; /**< index of current element */
ecma_value_t *current_value_p; /**< pointer to current element */
ecma_value_t *current_chunk_beg_p; /**< pointer to beginning of current chunk's data */
ecma_value_t *current_chunk_end_p; /**< pointer to place right after the end of current chunk's data */
} ecma_collection_iterator_t;
extern void
ecma_collection_iterator_init (ecma_collection_iterator_t *iterator_p,
ecma_collection_header_t *collection_p);
extern bool
ecma_collection_iterator_next (ecma_collection_iterator_t *iterator_p);
/* ecma-helpers.c */
extern ecma_object_t* ecma_create_object (ecma_object_t *prototype_object_p,
bool is_extensible,
@@ -147,8 +167,6 @@ extern void ecma_free_property (ecma_property_t *prop_p);
extern void ecma_delete_property (ecma_object_t *obj_p, ecma_property_t *prop_p);
extern void ecma_free_collection (ecma_collection_header_t *collection_header_p);
extern ecma_property_descriptor_t ecma_make_empty_property_descriptor (void);
#endif /* !JERRY_ECMA_HELPERS_H */