1/*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#pragma once
22
23#include "InternalFunction.h"
24
25namespace JSC {
26
27class ErrorPrototype;
28class GetterSetter;
29
30class ErrorConstructor final : public InternalFunction {
31public:
32 using Base = InternalFunction;
33
34 static ErrorConstructor* create(VM& vm, Structure* structure, ErrorPrototype* errorPrototype, GetterSetter*)
35 {
36 ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(vm, structure);
37 constructor->finishCreation(vm, errorPrototype);
38 return constructor;
39 }
40
41 DECLARE_INFO;
42
43 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
44 {
45 return Structure::create(vm, globalObject, prototype, TypeInfo(InternalFunctionType, StructureFlags), info());
46 }
47
48protected:
49 void finishCreation(VM&, ErrorPrototype*);
50
51 static bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
52 static bool deleteProperty(JSCell*, ExecState*, PropertyName);
53
54private:
55 ErrorConstructor(VM&, Structure*);
56
57};
58
59static_assert(sizeof(ErrorConstructor) == sizeof(InternalFunction), "");
60
61} // namespace JSC
62