#ifndef JSWithScope_h
#define JSWithScope_h
#include "JSGlobalObject.h"
namespace JSC {
class JSWithScope : public JSScope {
public:
typedef JSScope Base;
static JSWithScope* create(ExecState* exec, JSObject* object)
{
JSWithScope* withScope = new (NotNull, allocateCell<JSWithScope>(*exec->heap())) JSWithScope(exec, object);
withScope->finishCreation(exec->vm());
return withScope;
}
static JSWithScope* create(ExecState* exec, JSObject* object, JSScope* next)
{
JSWithScope* withScope = new (NotNull, allocateCell<JSWithScope>(*exec->heap())) JSWithScope(exec, object, next);
withScope->finishCreation(exec->vm());
return withScope;
}
JSObject* object() { return m_object.get(); }
static void visitChildren(JSCell*, SlotVisitor&);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
{
return Structure::create(vm, globalObject, proto, TypeInfo(WithScopeType, StructureFlags), info());
}
DECLARE_EXPORT_INFO;
protected:
static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags;
private:
JSWithScope(ExecState* exec, JSObject* object)
: Base(
exec->vm(),
exec->lexicalGlobalObject()->withScopeStructure(),
exec->scope()
)
, m_object(exec->vm(), this, object)
{
}
JSWithScope(ExecState* exec, JSObject* object, JSScope* next)
: Base(
exec->vm(),
exec->lexicalGlobalObject()->withScopeStructure(),
next
)
, m_object(exec->vm(), this, object)
{
}
WriteBarrier<JSObject> m_object;
};
}
#endif // JSWithScope_h