/* * Copyright (c) 2021, Ali Mohammad Pur * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace JS { class AsyncFunctionDriverWrapper final : public Promise { JS_OBJECT(AsyncFunctionDriverWrapper, Promise); public: static ThrowCompletionOr create(Realm&, GeneratorObject*); virtual ~AsyncFunctionDriverWrapper() override = default; void visit_edges(Cell::Visitor&) override; void continue_async_execution(VM&, Value, bool is_successful); private: AsyncFunctionDriverWrapper(Realm&, NonnullGCPtr, NonnullGCPtr top_level_promise); bool m_expect_promise { false }; NonnullGCPtr m_generator_object; NonnullGCPtr m_on_fulfillment; NonnullGCPtr m_on_rejection; NonnullGCPtr m_top_level_promise; GCPtr m_current_promise { nullptr }; Handle m_self_handle; }; }