ladybird/Libraries/LibJS/Runtime/Symbol.h
Shannon Booth f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00

37 lines
819 B
C++

/*
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <LibJS/Heap/Cell.h>
namespace JS {
class Symbol final : public Cell {
GC_CELL(Symbol, Cell);
GC_DECLARE_ALLOCATOR(Symbol);
public:
[[nodiscard]] static GC::Ref<Symbol> create(VM&, Optional<String> description, bool is_global);
virtual ~Symbol() = default;
Optional<String> const& description() const { return m_description; }
bool is_global() const { return m_is_global; }
ErrorOr<String> descriptive_string() const;
Optional<String> key() const;
private:
Symbol(Optional<String>, bool);
Optional<String> m_description;
bool m_is_global;
};
}