/* * Copyright (c) 2022, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace JS { // 27.6.2 Properties of AsyncGenerator Instances, https://tc39.es/ecma262/#sec-properties-of-asyncgenerator-intances class AsyncGenerator final : public Object { JS_OBJECT(AsyncGenerator, Object); public: enum class State { SuspendedStart, SuspendedYield, Executing, AwaitingReturn, Completed, }; explicit AsyncGenerator(Object& prototype); virtual ~AsyncGenerator() override = default; private: virtual void visit_edges(Cell::Visitor&) override; // At the time of constructing an AsyncGenerator, we still need to point to an // execution context on the stack, but later need to 'adopt' it. using ExecutionContextVariant = Variant; Optional m_async_generator_state; // [[AsyncGeneratorState]] ExecutionContextVariant m_async_generator_context; // [[AsyncGeneratorContext]] Vector m_async_generator_queue; // [[AsyncGeneratorQueue]] Optional m_generator_brand; // [[GeneratorBrand]] }; }