LibJS: Convert Map::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent 45f903da00
commit d48cdc7fa6
Notes: sideshowbarker 2024-07-17 03:17:37 +09:00
3 changed files with 4 additions and 4 deletions

View file

@ -863,7 +863,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group_to_map)
}
// 7. Let map be ! Construct(%Map%).
auto* map = Map::create(realm);
auto map = Map::create(realm);
// 8. For each Record { [[Key]], [[Elements]] } g of groups, do
for (auto& group : groups) {

View file

@ -8,9 +8,9 @@
namespace JS {
Map* Map::create(Realm& realm)
NonnullGCPtr<Map> Map::create(Realm& realm)
{
return realm.heap().allocate<Map>(realm, *realm.intrinsics().map_prototype());
return *realm.heap().allocate<Map>(realm, *realm.intrinsics().map_prototype());
}
Map::Map(Object& prototype)

View file

@ -20,7 +20,7 @@ class Map : public Object {
JS_OBJECT(Map, Object);
public:
static Map* create(Realm&);
static NonnullGCPtr<Map> create(Realm&);
virtual ~Map() override = default;