#pragma once
#include "JSObject.h"
namespace JSC {
class ObjectPrototype;
class ErrorPrototypeBase : public JSNonFinalObject {
public:
using Base = JSNonFinalObject;
protected:
ErrorPrototypeBase(VM&, Structure*);
void finishCreation(VM&, const String&);
};
class ErrorPrototype final : public ErrorPrototypeBase {
public:
using Base = ErrorPrototypeBase;
static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
template<typename CellType, SubspaceAccess>
static IsoSubspace* subspaceFor(VM& vm)
{
STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(ErrorPrototypeBase, Base);
return &vm.plainObjectSpace;
}
DECLARE_INFO;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
}
static ErrorPrototype* create(VM& vm, JSGlobalObject*, Structure* structure)
{
ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(vm, structure);
prototype->finishCreation(vm, "Error"_s);
return prototype;
}
private:
ErrorPrototype(VM&, Structure*);
};
}