mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:17:45 +00:00
LibJS: Make MarkedValueList inherit from Vector<Value>
This makes the nicer vector API available to MVL without extra wrapper functions.
This commit is contained in:
parent
9a00699983
commit
8d9c5a8e70
2 changed files with 10 additions and 15 deletions
|
@ -36,8 +36,8 @@ MarkedValueList::MarkedValueList(Heap& heap)
|
|||
}
|
||||
|
||||
MarkedValueList::MarkedValueList(MarkedValueList&& other)
|
||||
: m_heap(other.m_heap)
|
||||
, m_values(move(other.m_values))
|
||||
: AK::Vector<Value, 32>(move(static_cast<Vector<Value, 32>&>(other)))
|
||||
, m_heap(other.m_heap)
|
||||
{
|
||||
m_heap.did_create_marked_value_list({}, *this);
|
||||
}
|
||||
|
@ -47,9 +47,4 @@ MarkedValueList::~MarkedValueList()
|
|||
m_heap.did_destroy_marked_value_list({}, *this);
|
||||
}
|
||||
|
||||
void MarkedValueList::append(Value value)
|
||||
{
|
||||
m_values.append(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
class MarkedValueList {
|
||||
class MarkedValueList : public AK::Vector<Value, 32> {
|
||||
AK_MAKE_NONCOPYABLE(MarkedValueList);
|
||||
|
||||
public:
|
||||
|
@ -43,16 +43,16 @@ public:
|
|||
|
||||
MarkedValueList& operator=(MarkedValueList&&) = delete;
|
||||
|
||||
bool is_empty() const { return m_values.is_empty(); }
|
||||
size_t size() const { return m_values.size(); }
|
||||
void clear() { m_values.clear(); }
|
||||
Vector<Value, 32>& values() { return m_values; }
|
||||
Vector<Value, 32>& values() { return *this; }
|
||||
|
||||
void append(Value);
|
||||
MarkedValueList copy() const
|
||||
{
|
||||
MarkedValueList copy { m_heap };
|
||||
copy.append(*this);
|
||||
return copy;
|
||||
}
|
||||
|
||||
private:
|
||||
Heap& m_heap;
|
||||
Vector<Value, 32> m_values;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue