2021-11-23 14:01:35 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, David Tuin <davidot@serenityos.org>
|
2023-04-12 22:47:15 +00:00
|
|
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
2021-11-23 14:01:35 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/AsyncFromSyncIterator.h>
|
|
|
|
#include <LibJS/Runtime/AsyncFromSyncIteratorPrototype.h>
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
GC_DEFINE_ALLOCATOR(AsyncFromSyncIterator);
|
2023-11-19 08:45:05 +00:00
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
GC::Ref<AsyncFromSyncIterator> AsyncFromSyncIterator::create(Realm& realm, GC::Ref<IteratorRecord> sync_iterator_record)
|
2021-11-23 14:01:35 +00:00
|
|
|
{
|
2024-11-13 16:50:17 +00:00
|
|
|
return realm.create<AsyncFromSyncIterator>(realm, sync_iterator_record);
|
2021-11-23 14:01:35 +00:00
|
|
|
}
|
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, GC::Ref<IteratorRecord> sync_iterator_record)
|
2023-04-12 22:47:15 +00:00
|
|
|
: Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().async_from_sync_iterator_prototype())
|
2021-11-23 14:01:35 +00:00
|
|
|
, m_sync_iterator_record(sync_iterator_record)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void AsyncFromSyncIterator::visit_edges(Cell::Visitor& visitor)
|
|
|
|
{
|
2023-03-21 17:08:44 +00:00
|
|
|
Base::visit_edges(visitor);
|
2023-12-07 09:44:41 +00:00
|
|
|
visitor.visit(m_sync_iterator_record);
|
2021-11-23 14:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|