mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibJS: Convert AsyncFromSyncIterator::create() to NonnullGCPtr
This commit is contained in:
parent
4763cab323
commit
6528cbf51b
Notes:
sideshowbarker
2024-07-17 05:58:46 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/6528cbf51b Pull-request: https://github.com/SerenityOS/serenity/pull/16479 Reviewed-by: https://github.com/davidot ✅
3 changed files with 4 additions and 4 deletions
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace JS {
|
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)
|
AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterator_record)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class AsyncFromSyncIterator final : public Object {
|
||||||
JS_OBJECT(AsyncFromSyncIterator, Object);
|
JS_OBJECT(AsyncFromSyncIterator, Object);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static AsyncFromSyncIterator* create(Realm&, Iterator sync_iterator_record);
|
static NonnullGCPtr<AsyncFromSyncIterator> create(Realm&, Iterator sync_iterator_record);
|
||||||
|
|
||||||
virtual void initialize(Realm&) override;
|
virtual void initialize(Realm&) override;
|
||||||
virtual ~AsyncFromSyncIterator() override = default;
|
virtual ~AsyncFromSyncIterator() override = default;
|
||||||
|
|
|
@ -202,7 +202,7 @@ Iterator create_async_from_sync_iterator(VM& vm, Iterator sync_iterator_record)
|
||||||
|
|
||||||
// 1. Let asyncIterator be OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »).
|
// 1. Let asyncIterator be OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »).
|
||||||
// 2. Set asyncIterator.[[SyncIteratorRecord]] to 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").
|
// 3. Let nextMethod be ! Get(asyncIterator, "next").
|
||||||
auto next_method = MUST(async_iterator->get(vm.names.next));
|
auto next_method = MUST(async_iterator->get(vm.names.next));
|
||||||
|
|
Loading…
Reference in a new issue