ladybird/Userland/Libraries/LibJS/Runtime/Symbol.h
Linus Groh a8bf2f8e4c LibJS: Port Symbol to String
This includes the VM's global_symbol_registry HashMap, which can now
store String keys.
2023-02-11 21:47:57 +00:00

35 lines
756 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 {
JS_CELL(Symbol, Cell);
public:
[[nodiscard]] static NonnullGCPtr<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;
private:
Symbol(Optional<String>, bool);
Optional<String> m_description;
bool m_is_global;
};
}