AsyncFromSyncIterator.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. NonnullGCPtr<AsyncFromSyncIterator> AsyncFromSyncIterator::create(Realm& realm, IteratorRecord sync_iterator_record)
  12. {
  13. return realm.heap().allocate<AsyncFromSyncIterator>(realm, realm, sync_iterator_record).release_allocated_value_but_fixme_should_propagate_errors();
  14. }
  15. AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, IteratorRecord sync_iterator_record)
  16. : Object(ConstructWithPrototypeTag::Tag, realm.intrinsics().async_from_sync_iterator_prototype())
  17. , m_sync_iterator_record(sync_iterator_record)
  18. {
  19. }
  20. void AsyncFromSyncIterator::visit_edges(Cell::Visitor& visitor)
  21. {
  22. Base::visit_edges(visitor);
  23. visitor.visit(m_sync_iterator_record.iterator);
  24. visitor.visit(m_sync_iterator_record.next_method);
  25. }
  26. }