• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright JS Foundation and other contributors, http://js.foundation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ECMA_ITERATOR_OBJECT_H
17 #define ECMA_ITERATOR_OBJECT_H
18 
19 #include "ecma-globals.h"
20 
21 #if ENABLED (JERRY_ES2015)
22 
23 /** \addtogroup ecma ECMA
24  * @{
25  *
26  * \addtogroup ecmaiteratorobject ECMA iterator object related routines
27  * @{
28  */
29 
30 /**
31  * Generator resume execution flags.
32  */
33 typedef enum
34 {
35   ECMA_ITERATOR_NEXT, /**< generator should continue its execution */
36   ECMA_ITERATOR_RETURN, /**< generator should perform a return operation */
37   ECMA_ITERATOR_THROW, /**< generator should perform a throw operation */
38 } ecma_iterator_command_type_t;
39 
40 /**
41  * Maximum value of [[%Iterator%NextIndex]] until it can be stored
42  * in an ecma pseudo array object structure element.
43  */
44 #define ECMA_ITERATOR_INDEX_LIMIT UINT16_MAX
45 
46 ecma_value_t
47 ecma_op_create_iterator_object (ecma_value_t iterated_value, ecma_object_t *prototype_obj_p,
48                                 uint8_t iterator_type, uint8_t extra_info);
49 
50 ecma_value_t
51 ecma_create_iter_result_object (ecma_value_t value, ecma_value_t done);
52 
53 ecma_value_t
54 ecma_create_array_from_iter_element (ecma_value_t value, ecma_value_t index_value);
55 
56 ecma_value_t
57 ecma_op_get_iterator (ecma_value_t value, ecma_value_t method);
58 
59 ecma_value_t
60 ecma_op_iterator_value (ecma_value_t iter_result);
61 
62 ecma_value_t
63 ecma_op_iterator_close (ecma_value_t iterator);
64 
65 ecma_value_t
66 ecma_op_iterator_step (ecma_value_t iterator);
67 
68 ecma_value_t
69 ecma_op_iterator_do (ecma_iterator_command_type_t command, ecma_value_t iterator,
70                      ecma_value_t value, bool *done_p);
71 
72 #endif /* ENABLED (JERRY_ES2015) */
73 
74 /**
75  * @}
76  * @}
77  */
78 
79 #endif /* !ECMA_ITERATOR_OBJECT_H */
80