blob: b4ae8dc148c7b1ea720a5b46f4d8c4e58f027bf0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/*
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <AK/StringView.h>
#include <LibJS/Heap/Cell.h>
namespace JS {
class Symbol final : public Cell {
AK_MAKE_NONCOPYABLE(Symbol);
AK_MAKE_NONMOVABLE(Symbol);
public:
Symbol(Optional<String>, bool);
virtual ~Symbol() = default;
String description() const { return m_description.value_or(""); }
Optional<String> 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<String> m_description;
bool m_is_global;
};
Symbol* js_symbol(Heap&, Optional<String> description, bool is_global);
Symbol* js_symbol(VM&, Optional<String> description, bool is_global);
}
|