#ifndef JSNameScope_h
#define JSNameScope_h
#include "JSEnvironmentRecord.h"
#include "JSGlobalObject.h"
namespace JSC {
class JSNameScope : public JSEnvironmentRecord {
public:
typedef JSEnvironmentRecord Base;
static const unsigned StructureFlags = Base::StructureFlags| OverridesGetOwnPropertySlot;
enum Type {
CatchScope,
FunctionNameScope
};
template<typename T>
static T* create(VM& vm, JSGlobalObject* globalObject, JSScope* currentScope, SymbolTable* symbolTable, JSValue value)
{
T* scopeObject = new (
NotNull, allocateCell<T>(vm.heap, allocationSizeForScopeSize(1)))
T(vm, globalObject, currentScope, symbolTable);
scopeObject->finishCreation(vm, value);
return scopeObject;
}
static JSNameScope* create(VM&, JSGlobalObject*, JSScope* currentScope, SymbolTable*, JSValue, Type);
static JSValue toThis(JSCell*, ExecState*, ECMAMode);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
DECLARE_INFO;
JSValue value() { return variableAt(ScopeOffset(0)).get(); }
protected:
void finishCreation(VM& vm, JSValue value)
{
Base::finishCreationUninitialized(vm);
variableAt(ScopeOffset(0)).set(vm, this, value);
}
JSNameScope(VM& vm, Structure* structure, JSScope* next, SymbolTable* symbolTable)
: Base(vm, structure, next, symbolTable)
{
ASSERT(symbolTable->scopeSize() == 1);
}
};
}
#endif // JSNameScope_h