• 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 #include "ecma-globals.h"
17 
18 #if ENABLED (JERRY_ES2015)
19 
20 #define ECMA_BUILTINS_INTERNAL
21 #include "ecma-builtins-internal.h"
22 #include "ecma-function-object.h"
23 
24 #define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator-function.inc.h"
25 #define BUILTIN_UNDERSCORED_ID generator_function
26 #include "ecma-builtin-internal-routines-template.inc.h"
27 
28 /** \addtogroup ecma ECMA
29  * @{
30  *
31  * \addtogroup ecmabuiltins
32  * @{
33  *
34  * \addtogroup generator ECMA GeneratorFunction object built-in
35  * @{
36  */
37 
38 /**
39  * Handle calling [[Call]] of built-in GeneratorFunction object
40  *
41  * @return constructed generator function object - if success
42  *         raised error otherwise
43  */
44 ecma_value_t
ecma_builtin_generator_function_dispatch_call(const ecma_value_t * arguments_list_p,ecma_length_t arguments_list_len)45 ecma_builtin_generator_function_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
46                                                ecma_length_t arguments_list_len) /**< number of arguments */
47 {
48   JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
49 
50   return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_GENERATOR_FUNCTION);
51 } /* ecma_builtin_generator_function_dispatch_call */
52 
53 /**
54  * Handle calling [[Construct]] of built-in GeneratorFunction object
55  *
56 * @return constructed generator function object - if success
57  *        raised error otherwise
58  */
59 ecma_value_t
ecma_builtin_generator_function_dispatch_construct(const ecma_value_t * arguments_list_p,ecma_length_t arguments_list_len)60 ecma_builtin_generator_function_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
61                                                     ecma_length_t arguments_list_len) /**< number of arguments */
62 {
63   return ecma_builtin_generator_function_dispatch_call (arguments_list_p, arguments_list_len);
64 } /* ecma_builtin_generator_function_dispatch_construct */
65 
66 /**
67  * @}
68  * @}
69  * @}
70  */
71 
72 #endif /* ENABLED (JERRY_ES2015) */
73