|
@@ -19,28 +19,29 @@ class Set : public Object {
|
|
public:
|
|
public:
|
|
static Set* create(Realm&);
|
|
static Set* create(Realm&);
|
|
|
|
|
|
|
|
+ virtual void initialize(Realm&) override;
|
|
virtual ~Set() override = default;
|
|
virtual ~Set() override = default;
|
|
|
|
|
|
// NOTE: Unlike what the spec says, we implement Sets using an underlying map,
|
|
// NOTE: Unlike what the spec says, we implement Sets using an underlying map,
|
|
// so all the functions below do not directly implement the operations as
|
|
// so all the functions below do not directly implement the operations as
|
|
// defined by the specification.
|
|
// defined by the specification.
|
|
|
|
|
|
- void set_clear() { m_values.map_clear(); }
|
|
|
|
- bool set_remove(Value const& value) { return m_values.map_remove(value); }
|
|
|
|
- bool set_has(Value const& key) const { return m_values.map_has(key); }
|
|
|
|
- void set_add(Value const& key) { m_values.map_set(key, js_undefined()); }
|
|
|
|
- size_t set_size() const { return m_values.map_size(); }
|
|
|
|
|
|
+ void set_clear() { m_values->map_clear(); }
|
|
|
|
+ bool set_remove(Value const& value) { return m_values->map_remove(value); }
|
|
|
|
+ bool set_has(Value const& key) const { return m_values->map_has(key); }
|
|
|
|
+ void set_add(Value const& key) { m_values->map_set(key, js_undefined()); }
|
|
|
|
+ size_t set_size() const { return m_values->map_size(); }
|
|
|
|
|
|
- auto begin() const { return m_values.begin(); }
|
|
|
|
- auto begin() { return m_values.begin(); }
|
|
|
|
- auto end() const { return m_values.end(); }
|
|
|
|
|
|
+ auto begin() const { return const_cast<Map const&>(*m_values).begin(); }
|
|
|
|
+ auto begin() { return m_values->begin(); }
|
|
|
|
+ auto end() const { return m_values->end(); }
|
|
|
|
|
|
private:
|
|
private:
|
|
explicit Set(Object& prototype);
|
|
explicit Set(Object& prototype);
|
|
|
|
|
|
virtual void visit_edges(Visitor& visitor) override;
|
|
virtual void visit_edges(Visitor& visitor) override;
|
|
|
|
|
|
- Map m_values;
|
|
|
|
|
|
+ GCPtr<Map> m_values;
|
|
};
|
|
};
|
|
|
|
|
|
}
|
|
}
|