#pragma once
#include "HashMapImpl.h"
#include "JSObject.h"
namespace JSC {
class JSSet final : public HashMapImpl<HashMapBucket<HashMapBucketDataKey>> {
using Base = HashMapImpl<HashMapBucket<HashMapBucketDataKey>>;
public:
DECLARE_EXPORT_INFO;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(JSSetType, StructureFlags), info());
}
static JSSet* create(ExecState* exec, VM& vm, Structure* structure)
{
return create(exec, vm, structure, 0);
}
static JSSet* create(ExecState* exec, VM& vm, Structure* structure, uint32_t size)
{
JSSet* instance = new (NotNull, allocateCell<JSSet>(vm.heap)) JSSet(vm, structure, size);
instance->finishCreation(exec, vm);
return instance;
}
bool isIteratorProtocolFastAndNonObservable();
bool canCloneFastAndNonObservable(Structure*);
JSSet* clone(ExecState*, VM&, Structure*);
private:
JSSet(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
JSSet(VM& vm, Structure* structure, uint32_t sizeHint)
: Base(vm, structure, sizeHint)
{
}
static String toStringName(const JSObject*, ExecState*);
};
inline bool isJSSet(JSCell* from)
{
static_assert(std::is_final<JSSet>::value, "");
return from->type() == JSSetType;
}
inline bool isJSSet(JSValue from)
{
static_assert(std::is_final<JSSet>::value, "");
return from.isCell() && from.asCell()->type() == JSSetType;
}
}