/* * Copyright (c) 2020, Matthew Olsson * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace JS { class Symbol final : public Cell { AK_MAKE_NONCOPYABLE(Symbol); AK_MAKE_NONMOVABLE(Symbol); public: Symbol(Optional, bool); virtual ~Symbol() = default; String description() const { return m_description.value_or(""); } Optional const& raw_description() const { return m_description; } bool is_global() const { return m_is_global; } String to_string() const { return String::formatted("Symbol({})", description()); } private: virtual StringView class_name() const override { return "Symbol"sv; } Optional m_description; bool m_is_global; }; Symbol* js_symbol(Heap&, Optional description, bool is_global); Symbol* js_symbol(VM&, Optional description, bool is_global); }