mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
Shell: Store ListValue's values in a NonnullRefPtrVector<Value>
A ListValue never stores null Values, so it makes sense to restrict it. This also propagates use of NonnullRefPtr to the create() helpers. There's a small bit of awkwardness around the use of initializer_list, since we cannot directly construct a NonnullRefPtrVector from one.
This commit is contained in:
parent
08e5371f44
commit
420e809fee
3 changed files with 16 additions and 16 deletions
10
Shell/AST.h
10
Shell/AST.h
|
@ -238,16 +238,16 @@ public:
|
|||
virtual bool is_list() const override { return true; }
|
||||
virtual bool is_list_without_resolution() const override { return true; }
|
||||
ListValue(Vector<String> values);
|
||||
ListValue(Vector<RefPtr<Value>> values)
|
||||
: m_contained_values(move(values))
|
||||
ListValue(Vector<NonnullRefPtr<Value>> values)
|
||||
: m_contained_values(move(static_cast<NonnullRefPtrVector<Value>&>(values)))
|
||||
{
|
||||
}
|
||||
|
||||
const Vector<RefPtr<Value>>& values() const { return m_contained_values; }
|
||||
Vector<RefPtr<Value>>& values() { return m_contained_values; }
|
||||
const NonnullRefPtrVector<Value>& values() const { return m_contained_values; }
|
||||
NonnullRefPtrVector<Value>& values() { return m_contained_values; }
|
||||
|
||||
private:
|
||||
Vector<RefPtr<Value>> m_contained_values;
|
||||
NonnullRefPtrVector<Value> m_contained_values;
|
||||
};
|
||||
|
||||
class StringValue final : public Value {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue