mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
LibJS: Add AsyncGenerator / AsyncGeneratorPrototype
Not implementing any prototype functions yet, but stubbing out async generator infrastructure will allow us to make some progress in that direction.
This commit is contained in:
parent
2c68ec9097
commit
0c65624a32
10 changed files with 162 additions and 9 deletions
30
Userland/Libraries/LibJS/Runtime/AsyncGenerator.cpp
Normal file
30
Userland/Libraries/LibJS/Runtime/AsyncGenerator.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/AsyncGenerator.h>
|
||||
#include <LibJS/Runtime/AsyncGeneratorPrototype.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
AsyncGenerator::AsyncGenerator(Object& prototype)
|
||||
: Object(prototype)
|
||||
{
|
||||
}
|
||||
|
||||
void AsyncGenerator::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
for (auto const& request : m_async_generator_queue) {
|
||||
if (request.completion.value().has_value())
|
||||
visitor.visit(*request.completion.value());
|
||||
visitor.visit(request.capability.promise);
|
||||
visitor.visit(request.capability.reject);
|
||||
visitor.visit(request.capability.resolve);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue