#ifndef JSNameScope_h
#define JSNameScope_h
#include "JSGlobalObject.h"
#include "JSVariableObject.h"
namespace JSC {
class JSNameScope : public JSVariableObject {
public:
typedef JSVariableObject Base;
static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
{
JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(*exec->heap())) JSNameScope(exec, exec->scope());
scopeObject->finishCreation(exec, identifier, value, attributes);
return scopeObject;
}
static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes, JSScope* next)
{
JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(*exec->heap())) JSNameScope(exec, next);
scopeObject->finishCreation(exec, identifier, value, attributes);
return scopeObject;
}
static void visitChildren(JSCell*, SlotVisitor&);
bool isDynamicScope(bool& requiresDynamicChecks) const;
static JSObject* toThisObject(JSCell*, ExecState*);
static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(vm, globalObject, proto, TypeInfo(NameScopeObjectType, StructureFlags), &s_info); }
static const ClassInfo s_info;
protected:
void finishCreation(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
{
Base::finishCreation(exec->vm());
m_registerStore.set(exec->vm(), this, value);
symbolTable()->add(identifier.impl(), SymbolTableEntry(-1, attributes));
}
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | Base::StructureFlags;
private:
JSNameScope(ExecState* exec, JSScope* next)
: Base(
exec->vm(),
exec->lexicalGlobalObject()->nameScopeStructure(),
reinterpret_cast<Register*>(&m_registerStore + 1),
next
)
{
}
WriteBarrier<Unknown> m_registerStore;
};
inline bool JSNameScope::isDynamicScope(bool&) const
{
return false;
}
}
#endif // JSNameScope_h