2020-04-04 10:34:31 -03:00
|
|
|
/*
|
2021-04-22 17:51:19 -03:00
|
|
|
* Copyright (c) 2020, Linus Groh <linusg@serenityos.org>
|
2020-04-04 10:34:31 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-04 10:34:31 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/NativeFunction.h>
|
|
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
|
|
class FunctionConstructor final : public NativeFunction {
|
2020-06-21 10:14:02 -03:00
|
|
|
JS_OBJECT(FunctionConstructor, NativeFunction);
|
|
|
|
|
|
2020-04-04 10:34:31 -03:00
|
|
|
public:
|
2021-06-27 16:48:34 -03:00
|
|
|
static RefPtr<FunctionExpression> create_dynamic_function_node(GlobalObject& global_object, FunctionObject& new_target, FunctionKind kind);
|
2021-06-16 14:52:48 -03:00
|
|
|
|
2020-06-20 10:40:48 -03:00
|
|
|
explicit FunctionConstructor(GlobalObject&);
|
2020-07-22 12:50:18 -03:00
|
|
|
virtual void initialize(GlobalObject&) override;
|
2020-04-04 10:34:31 -03:00
|
|
|
virtual ~FunctionConstructor() override;
|
|
|
|
|
|
2020-09-27 12:24:14 -03:00
|
|
|
virtual Value call() override;
|
2021-06-27 16:48:34 -03:00
|
|
|
virtual Value construct(FunctionObject& new_target) override;
|
2020-04-04 10:34:31 -03:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
virtual bool has_constructor() const override { return true; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|