2021-11-23 14:01:35 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, David Tuin <davidot@serenityos.org>
|
2022-01-09 18:12:24 +00:00
|
|
|
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
2021-11-23 14:01:35 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-01-09 18:12:24 +00:00
|
|
|
#include <LibJS/Runtime/Iterator.h>
|
2021-11-23 14:01:35 +00:00
|
|
|
#include <LibJS/Runtime/Object.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
// 27.1.4.3 Properties of Async-from-Sync Iterator Instances, https://tc39.es/ecma262/#sec-properties-of-async-from-sync-iterator-instances
|
|
|
|
class AsyncFromSyncIterator final : public Object {
|
|
|
|
JS_OBJECT(AsyncFromSyncIterator, Object);
|
2024-11-14 15:01:23 +00:00
|
|
|
GC_DECLARE_ALLOCATOR(AsyncFromSyncIterator);
|
2021-11-23 14:01:35 +00:00
|
|
|
|
|
|
|
public:
|
2024-11-14 15:01:23 +00:00
|
|
|
static GC::Ref<AsyncFromSyncIterator> create(Realm&, GC::Ref<IteratorRecord> sync_iterator_record);
|
2021-11-23 14:01:35 +00:00
|
|
|
|
|
|
|
virtual ~AsyncFromSyncIterator() override = default;
|
|
|
|
|
|
|
|
void visit_edges(Visitor& visitor) override;
|
|
|
|
|
2023-06-23 19:35:19 +00:00
|
|
|
IteratorRecord& sync_iterator_record() { return m_sync_iterator_record; }
|
|
|
|
IteratorRecord const& sync_iterator_record() const { return m_sync_iterator_record; }
|
2021-11-23 14:01:35 +00:00
|
|
|
|
|
|
|
private:
|
2024-11-14 15:01:23 +00:00
|
|
|
AsyncFromSyncIterator(Realm&, GC::Ref<IteratorRecord> sync_iterator_record);
|
2022-08-28 21:51:28 +00:00
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
GC::Ref<IteratorRecord> m_sync_iterator_record; // [[SyncIteratorRecord]]
|
2021-11-23 14:01:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|