1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:47:43 +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:
Andreas Kling 2020-08-07 09:33:05 +02:00
parent 08e5371f44
commit 420e809fee
3 changed files with 16 additions and 16 deletions

View file

@ -664,7 +664,7 @@ int Shell::builtin_shift(int argc, const char** argv)
}
if (!argv_->is_list())
argv_ = adopt(*new AST::ListValue({ argv_ }));
argv_ = adopt(*new AST::ListValue({ argv_.release_nonnull() }));
auto& values = static_cast<AST::ListValue*>(argv_.ptr())->values();
if ((size_t)count > values.size()) {