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-alloc.h"
17#include "ecma-conversion.h"
18#include "ecma-exceptions.h"
19#include "ecma-eval.h"
20#include "ecma-gc.h"
21#include "ecma-function-object.h"
22#include "ecma-lex-env.h"
23#include "ecma-try-catch-macro.h"
24#include "js-parser.h"
25#include "lit-magic-strings.h"
26
27#if ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ERROR_MESSAGES) || ENABLED (JERRY_ES2015_MODULE_SYSTEM)
28#include "jcontext.h"
29#endif /* ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ERROR_MESSAGES) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
30
31#define ECMA_BUILTINS_INTERNAL
32#include "ecma-builtins-internal.h"
33
34#define BUILTIN_INC_HEADER_NAME "ecma-builtin-function.inc.h"
35#define BUILTIN_UNDERSCORED_ID function
36#include "ecma-builtin-internal-routines-template.inc.h"
37
38/** \addtogroup ecma ECMA
39 * @{
40 *
41 * \addtogroup ecmabuiltins
42 * @{
43 *
44 * \addtogroup function ECMA Function object built-in
45 * @{
46 */
47
48/**
49 * Handle calling [[Call]] of built-in Function object
50 *
51 * @return ecma value
52 */
53ecma_value_t
54ecma_builtin_function_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
55                                     ecma_length_t arguments_list_len) /**< number of arguments */
56{
57  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
58
59  return ecma_builtin_function_dispatch_construct (arguments_list_p, arguments_list_len);
60} /* ecma_builtin_function_dispatch_call */
61
62/**
63 * Handle calling [[Construct]] of built-in Function object
64 *
65 * See also:
66 *          ECMA-262 v5, 15.3.
67 *
68 * @return ecma value
69 */
70ecma_value_t
71ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
72                                          ecma_length_t arguments_list_len) /**< number of arguments */
73{
74  return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_NO_OPTS);
75} /* ecma_builtin_function_dispatch_construct */
76
77/**
78 * @}
79 * @}
80 * @}
81 */
82