iotjs update 2018.01.29
[platform/upstream/iotjs.git] / deps / jerry / jerry-core / ecma / builtin-objects / typedarray / ecma-builtin-uint32array.c
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-gc.h"
19 #include "ecma-globals.h"
20 #include "ecma-helpers.h"
21 #include "ecma-typedarray-object.h"
22 #include "jrt.h"
23
24 #ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
25
26 #define ECMA_BUILTINS_INTERNAL
27 #include "ecma-builtins-internal.h"
28
29 #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint32array.inc.h"
30 #define BUILTIN_UNDERSCORED_ID uint32array
31 #include "ecma-builtin-internal-routines-template.inc.h"
32
33 /** \addtogroup ecma ECMA
34  * @{
35  *
36  * \addtogroup ecmabuiltins
37  * @{
38  *
39  * \addtogroup uint32array ECMA Uint32Array object built-in
40  * @{
41  */
42
43 /**
44  * Handle calling [[Call]] of Uint32Array
45  *
46  * @return ecma value
47  */
48 ecma_value_t
49 ecma_builtin_uint32array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
50                                         ecma_length_t arguments_list_len) /**< number of arguments */
51 {
52   JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
53
54   return ecma_raise_type_error (ECMA_ERR_MSG ("Uint32Array cannot be directly called"));
55 } /* ecma_builtin_uint32array_dispatch_call */
56
57 /**
58  * Handle calling [[Construct]] of Uint32Array
59  *
60  * @return ecma value
61  */
62 ecma_value_t
63 ecma_builtin_uint32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
64                                              ecma_length_t arguments_list_len) /**< number of arguments */
65 {
66   JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
67
68   ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE);
69   ecma_value_t val = ecma_op_create_typedarray (arguments_list_p,
70                                                 arguments_list_len,
71                                                 prototype_obj_p,
72                                                 2,
73                                                 LIT_MAGIC_STRING_UINT32_ARRAY_UL);
74
75   ecma_deref_object (prototype_obj_p);
76
77   return val;
78 } /* ecma_builtin_uint32array_dispatch_construct */
79
80 /**
81   * @}
82   * @}
83   * @}
84   */
85
86 #endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */