/* * Copyright (c) 2021-2022, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace JS { // 27.2.1.2 PromiseReaction Records, https://tc39.es/ecma262/#sec-promisereaction-records class PromiseReaction final : public Cell { JS_CELL(PromiseReaction, Cell); public: enum class Type { Fulfill, Reject, }; static NonnullGCPtr create(VM& vm, Type type, GCPtr capability, Optional handler); virtual ~PromiseReaction() = default; Type type() const { return m_type; } GCPtr capability() const { return m_capability; } Optional& handler() { return m_handler; } Optional const& handler() const { return m_handler; } private: PromiseReaction(Type type, GCPtr capability, Optional handler); virtual void visit_edges(Visitor&) override; Type m_type; GCPtr m_capability; Optional m_handler; }; }