2021-11-23 11:01:35 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, David Tuin <davidot@serenityos.org>
|
2023-04-12 19:47:15 -03:00
|
|
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
2021-11-23 11:01:35 -03: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 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(AsyncFromSyncIterator);
|
2023-11-19 05:45:05 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<AsyncFromSyncIterator> AsyncFromSyncIterator::create(Realm& realm, GC::Ref<IteratorRecord> sync_iterator_record)
|
2021-11-23 11:01:35 -03:00
|
|
|
{
|
2024-11-13 13:50:17 -03:00
|
|
|
return realm.create<AsyncFromSyncIterator>(realm, sync_iterator_record);
|
2021-11-23 11:01:35 -03:00
|
|
|
}
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, GC::Ref<IteratorRecord> sync_iterator_record)
|
2023-04-12 19:47:15 -03:00
|
|
|
: Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().async_from_sync_iterator_prototype())
|
2021-11-23 11:01:35 -03:00
|
|
|
, m_sync_iterator_record(sync_iterator_record)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AsyncFromSyncIterator::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
2023-03-21 14:08:44 -03:00
|
|
|
Base::visit_edges(visitor);
|
2023-12-07 06:44:41 -03:00
|
|
|
visitor.visit(m_sync_iterator_record);
|
2021-11-23 11:01:35 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|