• 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-builtins.h"
17 #include "ecma-exceptions.h"
18 #include "ecma-container-object.h"
19 
20 #if ENABLED (JERRY_ES2015_BUILTIN_SET)
21 
22 #define ECMA_BUILTINS_INTERNAL
23 #include "ecma-builtins-internal.h"
24 
25 #define BUILTIN_INC_HEADER_NAME "ecma-builtin-set.inc.h"
26 #define BUILTIN_UNDERSCORED_ID set
27 #include "ecma-builtin-internal-routines-template.inc.h"
28 
29 /** \addtogroup ecma ECMA
30  * @{
31  *
32  * \addtogroup ecmabuiltins
33  * @{
34  *
35  * \addtogroup set ECMA Set object built-in
36  * @{
37  */
38 
39 /**
40  * Handle calling [[Call]] of built-in Set object
41  *
42  * @return ecma value
43  */
44 ecma_value_t
ecma_builtin_set_dispatch_call(const ecma_value_t * arguments_list_p,ecma_length_t arguments_list_len)45 ecma_builtin_set_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_raise_type_error (ECMA_ERR_MSG ("Constructor Set requires 'new'."));
51 } /* ecma_builtin_set_dispatch_call */
52 
53 /**
54  * Handle calling [[Construct]] of built-in Map object
55  *
56  * @return ecma value
57  */
58 ecma_value_t
ecma_builtin_set_dispatch_construct(const ecma_value_t * arguments_list_p,ecma_length_t arguments_list_len)59 ecma_builtin_set_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
60                                      ecma_length_t arguments_list_len) /**< number of arguments */
61 {
62   return ecma_op_container_create (arguments_list_p,
63                                    arguments_list_len,
64                                    LIT_MAGIC_STRING_SET_UL,
65                                    ECMA_BUILTIN_ID_SET_PROTOTYPE);
66 } /* ecma_builtin_set_dispatch_construct */
67 
68 /**
69  * 23.2.2.2 get Set [ @@species ] accessor
70  *
71  * @return ecma_value
72  *         returned value must be freed with ecma_free_value
73  */
74 ecma_value_t
ecma_builtin_set_species_get(ecma_value_t this_value)75 ecma_builtin_set_species_get (ecma_value_t this_value) /**< This Value */
76 {
77   return ecma_copy_value (this_value);
78 } /* ecma_builtin_set_species_get */
79 
80 /**
81  * @}
82  * @}
83  * @}
84  */
85 
86 #endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */
87