summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/AsyncGenerator.cpp
blob: 20c023afda79c92f8a1945a259a14f9e7e812625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * 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/AsyncGeneratorRequest.h>
#include <LibJS/Runtime/GlobalObject.h>

namespace JS {

AsyncGenerator::AsyncGenerator(Object& prototype)
    : Object(ConstructWithPrototypeTag::Tag, 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);
    }
}

}