1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:07: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:
AnotherTest 2020-09-08 13:27:27 +04:30 committed by Andreas Kling
parent 9a00699983
commit 8d9c5a8e70
2 changed files with 10 additions and 15 deletions

View file

@ -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;
};
}