• 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_FUNCTION_OBJECT_H
17 #define ECMA_FUNCTION_OBJECT_H
18 
19 #include "ecma-globals.h"
20 #include "ecma-builtins.h"
21 #include "vm.h"
22 
23 /** \addtogroup ecma ECMA
24  * @{
25  *
26  * \addtogroup ecmafunctionobject ECMA Function object related routines
27  * @{
28  */
29 
30 #if ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ES2015_MODULE_SYSTEM)
31 ecma_value_t ecma_op_resource_name (const ecma_compiled_code_t *bytecode_header_p);
32 #endif /* ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
33 
34 bool ecma_op_is_callable (ecma_value_t value);
35 bool ecma_op_object_is_callable (ecma_object_t *obj_p);
36 bool ecma_is_constructor (ecma_value_t value);
37 bool ecma_object_is_constructor (ecma_object_t *obj_p);
38 
39 ecma_object_t *
40 ecma_op_create_simple_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p);
41 
42 ecma_object_t *
43 ecma_op_create_external_function_object (ecma_external_handler_t handler_cb);
44 
45 const ecma_compiled_code_t *
46 ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p);
47 
48 ecma_value_t
49 ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p,
50                                  ecma_length_t arguments_list_len,
51                                  ecma_parse_opts_t opts);
52 
53 #if ENABLED (JERRY_ES2015)
54 ecma_value_t
55 ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p);
56 
57 ecma_object_t *
58 ecma_op_create_generator_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p);
59 
60 ecma_object_t *
61 ecma_op_create_arrow_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p,
62                                       ecma_value_t this_binding);
63 bool
64 ecma_op_function_is_generator (ecma_object_t *func_obj_p);
65 #endif /* ENABLED (JERRY_ES2015) */
66 
67 ecma_object_t *
68 ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, ecma_builtin_id_t default_proto_id);
69 
70 ecma_value_t
71 ecma_op_function_has_instance (ecma_object_t *func_obj_p, ecma_value_t value);
72 
73 ecma_value_t
74 ecma_op_function_call (ecma_object_t *func_obj_p, ecma_value_t this_arg_value,
75                        const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len);
76 
77 ecma_value_t
78 ecma_op_function_construct (ecma_object_t *func_obj_p, ecma_object_t *new_target_p,
79                             const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len);
80 
81 ecma_property_t *
82 ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
83 
84 ecma_property_t *
85 ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
86 
87 ecma_property_t *
88 ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
89 
90 void
91 ecma_op_function_list_lazy_property_names (ecma_object_t *object_p,
92                                            uint32_t opts,
93                                            ecma_collection_t *main_collection_p,
94                                            ecma_collection_t *non_enum_collection_p);
95 
96 void
97 ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p,
98                                                     uint32_t opts,
99                                                     ecma_collection_t *main_collection_p,
100                                                     ecma_collection_t *non_enum_collection_p);
101 
102 void
103 ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p,
104                                                  uint32_t opts,
105                                                  ecma_collection_t *main_collection_p,
106                                                  ecma_collection_t *non_enum_collection_p);
107 
108 /**
109  * @}
110  * @}
111  */
112 
113 #endif /* !ECMA_FUNCTION_OBJECT_H */
114