mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 05:07:35 +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
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/davidot
Commit: 064c8be627
Pull-request: https://github.com/SerenityOS/serenity/pull/11041
Reviewed-by: https://github.com/linusg
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