CustomGetterSetter.h [plain text]
#ifndef CustomGetterSetter_h
#define CustomGetterSetter_h
#include "JSCell.h"
#include "PropertySlot.h"
#include "PutPropertySlot.h"
#include "Structure.h"
namespace JSC {
class CustomGetterSetter final : public JSCell {
public:
typedef JSCell Base;
static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
typedef PropertySlot::GetValueFunc CustomGetter;
typedef PutPropertySlot::PutValueFunc CustomSetter;
static CustomGetterSetter* create(VM& vm, CustomGetter customGetter, CustomSetter customSetter)
{
CustomGetterSetter* customGetterSetter = new (NotNull, allocateCell<CustomGetterSetter>(vm.heap)) CustomGetterSetter(vm, customGetter, customSetter);
customGetterSetter->finishCreation(vm);
return customGetterSetter;
}
CustomGetterSetter::CustomGetter getter() const { return m_getter; }
CustomGetterSetter::CustomSetter setter() const { return m_setter; }
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(CustomGetterSetterType, StructureFlags), info());
}
DECLARE_EXPORT_INFO;
private:
CustomGetterSetter(VM& vm, CustomGetter getter, CustomSetter setter)
: JSCell(vm, vm.customGetterSetterStructure.get())
, m_getter(getter)
, m_setter(setter)
{
}
CustomGetter m_getter;
CustomSetter m_setter;
};
void callCustomSetter(ExecState*, JSValue customGetterSetter, JSObject* base, JSValue thisValue, JSValue value);
}
#endif // CustomGetterSetter_h