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_WEAKMAP)
21
22#define ECMA_BUILTINS_INTERNAL
23#include "ecma-builtins-internal.h"
24
25#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakmap.inc.h"
26#define BUILTIN_UNDERSCORED_ID weakmap
27#include "ecma-builtin-internal-routines-template.inc.h"
28
29/** \addtogroup ecma ECMA
30 * @{
31 *
32 * \addtogroup ecmabuiltins
33 * @{
34 *
35 * \addtogroup weakmap ECMA WeakMap object built-in
36 * @{
37 */
38
39/**
40 * Handle calling [[Call]] of built-in WeakMap object
41 *
42 * @return ecma value
43 */
44ecma_value_t
45ecma_builtin_weakmap_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 WeakMap requires 'new'."));
51} /* ecma_builtin_weakmap_dispatch_call */
52
53/**
54 * Handle calling [[Construct]] of built-in WeakMap object
55 *
56 * @return ecma value
57 */
58ecma_value_t
59ecma_builtin_weakmap_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_WEAKMAP_UL,
65                                   ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE);
66} /* ecma_builtin_weakmap_dispatch_construct */
67
68/**
69 * @}
70 * @}
71 * @}
72 */
73
74#endif /* ENABLED (JERRY_ES2015_BUILTIN_WEAKMAP) */
75