/* * 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 { GC_CELL(PromiseReaction, Cell); GC_DECLARE_ALLOCATOR(PromiseReaction); public: enum class Type { Fulfill, Reject, }; static GC::Ref create(VM& vm, Type type, GC::Ptr capability, GC::Ptr handler); virtual ~PromiseReaction() = default; Type type() const { return m_type; } GC::Ptr capability() const { return m_capability; } GC::Ptr handler() { return m_handler; } GC::Ptr handler() const { return m_handler; } private: PromiseReaction(Type type, GC::Ptr capability, GC::Ptr handler); virtual void visit_edges(Visitor&) override; Type m_type; GC::Ptr m_capability; GC::Ptr m_handler; }; }