1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

LibJS: Convert Set::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent 9946e9e874
commit 1c8b700248
3 changed files with 5 additions and 5 deletions

View file

@ -8,9 +8,9 @@
namespace JS {
Set* Set::create(Realm& realm)
NonnullGCPtr<Set> Set::create(Realm& realm)
{
return realm.heap().allocate<Set>(realm, *realm.intrinsics().set_prototype());
return *realm.heap().allocate<Set>(realm, *realm.intrinsics().set_prototype());
}
Set::Set(Object& prototype)
@ -29,7 +29,7 @@ NonnullGCPtr<Set> Set::copy() const
auto& realm = *vm.current_realm();
// FIXME: This is very inefficient, but there's no better way to do this at the moment, as the underlying Map
// implementation of m_values uses a non-copyable RedBlackTree.
auto* result = Set::create(realm);
auto result = Set::create(realm);
for (auto const& entry : *this)
result->set_add(entry.key);
return *result;