mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
LibJS: Add AsyncFromSyncIteratorPrototype and Async-From-Sync instances
Until we have actual iterator records we have to store the sync iterator as the raw object.
This commit is contained in:
parent
0535c1abbd
commit
064c8be627
8 changed files with 311 additions and 0 deletions
32
Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h
Normal file
32
Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2021, David Tuin <davidot@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#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);
|
||||
|
||||
public:
|
||||
static AsyncFromSyncIterator* create(GlobalObject&, Object* sync_iterator_record);
|
||||
|
||||
explicit AsyncFromSyncIterator(GlobalObject&, Object* sync_iterator_record);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual ~AsyncFromSyncIterator() override = default;
|
||||
|
||||
void visit_edges(Visitor& visitor) override;
|
||||
|
||||
Object& sync_iterator_record() const { return *m_sync_iterator_record; }
|
||||
|
||||
private:
|
||||
Object* m_sync_iterator_record { nullptr }; // [[SyncIteratorRecord]]
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue