LibJS: Convert AsyncFromSyncIterator::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent 4763cab323
commit 6528cbf51b
Notes: sideshowbarker 2024-07-17 05:58:46 +09:00
3 changed files with 4 additions and 4 deletions

View file

@ -11,9 +11,9 @@
namespace JS {
AsyncFromSyncIterator* AsyncFromSyncIterator::create(Realm& realm, Iterator sync_iterator_record)
NonnullGCPtr<AsyncFromSyncIterator> AsyncFromSyncIterator::create(Realm& realm, Iterator sync_iterator_record)
{
return realm.heap().allocate<AsyncFromSyncIterator>(realm, realm, sync_iterator_record);
return *realm.heap().allocate<AsyncFromSyncIterator>(realm, realm, sync_iterator_record);
}
AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterator_record)

View file

@ -17,7 +17,7 @@ class AsyncFromSyncIterator final : public Object {
JS_OBJECT(AsyncFromSyncIterator, Object);
public:
static AsyncFromSyncIterator* create(Realm&, Iterator sync_iterator_record);
static NonnullGCPtr<AsyncFromSyncIterator> create(Realm&, Iterator sync_iterator_record);
virtual void initialize(Realm&) override;
virtual ~AsyncFromSyncIterator() override = default;

View file

@ -202,7 +202,7 @@ Iterator create_async_from_sync_iterator(VM& vm, Iterator sync_iterator_record)
// 1. Let asyncIterator be OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »).
// 2. Set asyncIterator.[[SyncIteratorRecord]] to syncIteratorRecord.
auto* async_iterator = AsyncFromSyncIterator::create(realm, sync_iterator_record);
auto async_iterator = AsyncFromSyncIterator::create(realm, sync_iterator_record);
// 3. Let nextMethod be ! Get(asyncIterator, "next").
auto next_method = MUST(async_iterator->get(vm.names.next));