/src/serenity/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2021, David Tuin <davidot@serenityos.org> |
3 | | * Copyright (c) 2022, Linus Groh <linusg@serenityos.org> |
4 | | * |
5 | | * SPDX-License-Identifier: BSD-2-Clause |
6 | | */ |
7 | | |
8 | | #pragma once |
9 | | |
10 | | #include <LibJS/Runtime/Iterator.h> |
11 | | #include <LibJS/Runtime/Object.h> |
12 | | |
13 | | namespace JS { |
14 | | |
15 | | // 27.1.4.3 Properties of Async-from-Sync Iterator Instances, https://tc39.es/ecma262/#sec-properties-of-async-from-sync-iterator-instances |
16 | | class AsyncFromSyncIterator final : public Object { |
17 | | JS_OBJECT(AsyncFromSyncIterator, Object); |
18 | | JS_DECLARE_ALLOCATOR(AsyncFromSyncIterator); |
19 | | |
20 | | public: |
21 | | static NonnullGCPtr<AsyncFromSyncIterator> create(Realm&, NonnullGCPtr<IteratorRecord> sync_iterator_record); |
22 | | |
23 | | virtual ~AsyncFromSyncIterator() override = default; |
24 | | |
25 | | void visit_edges(Visitor& visitor) override; |
26 | | |
27 | 0 | IteratorRecord& sync_iterator_record() { return m_sync_iterator_record; } |
28 | 0 | IteratorRecord const& sync_iterator_record() const { return m_sync_iterator_record; } |
29 | | |
30 | | private: |
31 | | AsyncFromSyncIterator(Realm&, NonnullGCPtr<IteratorRecord> sync_iterator_record); |
32 | | |
33 | | NonnullGCPtr<IteratorRecord> m_sync_iterator_record; // [[SyncIteratorRecord]] |
34 | | }; |
35 | | |
36 | | } |