2020-04-30 06:25:21 +00:00
|
|
|
/*
|
2021-04-22 23:53:07 +00:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-04-30 06:25:21 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-30 06:25:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
|
|
#include <LibJS/Runtime/Symbol.h>
|
|
|
|
#include <LibJS/Runtime/SymbolObject.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
GC_DEFINE_ALLOCATOR(SymbolObject);
|
2023-11-19 08:45:05 +00:00
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
GC::Ref<SymbolObject> SymbolObject::create(Realm& realm, Symbol& primitive_symbol)
|
2020-04-30 06:25:21 +00:00
|
|
|
{
|
2024-11-13 16:50:17 +00:00
|
|
|
return realm.create<SymbolObject>(primitive_symbol, realm.intrinsics().symbol_prototype());
|
2020-04-30 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SymbolObject::SymbolObject(Symbol& symbol, Object& prototype)
|
2022-12-14 11:17:58 +00:00
|
|
|
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
2020-04-30 06:25:21 +00:00
|
|
|
, m_symbol(symbol)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-28 13:33:36 +00:00
|
|
|
void SymbolObject::visit_edges(Cell::Visitor& visitor)
|
2020-04-30 06:25:21 +00:00
|
|
|
{
|
2021-09-11 12:05:12 +00:00
|
|
|
Base::visit_edges(visitor);
|
2023-02-26 23:09:02 +00:00
|
|
|
visitor.visit(m_symbol);
|
2020-04-30 06:25:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|