AsyncFromSyncIterator.cpp 995 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2021, David Tuin <davidot@serenityos.org>
  3. * Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibJS/Runtime/AsyncFromSyncIterator.h>
  8. #include <LibJS/Runtime/AsyncFromSyncIteratorPrototype.h>
  9. #include <LibJS/Runtime/GlobalObject.h>
  10. namespace JS {
  11. GC_DEFINE_ALLOCATOR(AsyncFromSyncIterator);
  12. GC::Ref<AsyncFromSyncIterator> AsyncFromSyncIterator::create(Realm& realm, GC::Ref<IteratorRecord> sync_iterator_record)
  13. {
  14. return realm.create<AsyncFromSyncIterator>(realm, sync_iterator_record);
  15. }
  16. AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, GC::Ref<IteratorRecord> sync_iterator_record)
  17. : Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().async_from_sync_iterator_prototype())
  18. , m_sync_iterator_record(sync_iterator_record)
  19. {
  20. }
  21. void AsyncFromSyncIterator::visit_edges(Cell::Visitor& visitor)
  22. {
  23. Base::visit_edges(visitor);
  24. visitor.visit(m_sync_iterator_record);
  25. }
  26. }