#ifndef RUNTIME_ARRAY_H_
#define RUNTIME_ARRAY_H_
#include "BridgeJSC.h"
#include <runtime/ArrayPrototype.h>
namespace JSC {
class RuntimeArray : public JSArray {
public:
static RuntimeArray* create(ExecState* exec, Bindings::Array* array)
{
return new (allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, array);
}
typedef Bindings::Array BindingsArray;
virtual ~RuntimeArray();
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual void put(ExecState*, unsigned propertyName, JSValue);
virtual bool deleteProperty(ExecState* exec, const Identifier &propertyName);
virtual bool deleteProperty(ExecState* exec, unsigned propertyName);
unsigned getLength() const { return getConcreteArray()->getLength(); }
Bindings::Array* getConcreteArray() const { return static_cast<BindingsArray*>(subclassData()); }
static const ClassInfo s_info;
static ArrayPrototype* createPrototype(ExecState*, JSGlobalObject* globalObject)
{
return globalObject->arrayPrototype();
}
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSArray::StructureFlags;
private:
RuntimeArray(ExecState*, Bindings::Array*);
static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
static JSValue indexGetter(ExecState*, JSValue, unsigned);
};
}
#endif // RUNTIME_ARRAY_H_