
This is a continuation of the previous three commits. Now that create() receives the allocating realm, we can simply forward that to allocate(), which accounts for the majority of these changes. Additionally, we can get rid of the realm_from_global_object() in one place, with one more remaining in VM::throw_completion().
30 lines
679 B
C++
30 lines
679 B
C++
/*
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
#include <LibJS/Runtime/Symbol.h>
|
|
#include <LibJS/Runtime/SymbolObject.h>
|
|
|
|
namespace JS {
|
|
|
|
SymbolObject* SymbolObject::create(Realm& realm, Symbol& primitive_symbol)
|
|
{
|
|
return realm.heap().allocate<SymbolObject>(realm, primitive_symbol, *realm.global_object().symbol_prototype());
|
|
}
|
|
|
|
SymbolObject::SymbolObject(Symbol& symbol, Object& prototype)
|
|
: Object(prototype)
|
|
, m_symbol(symbol)
|
|
{
|
|
}
|
|
|
|
void SymbolObject::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(&m_symbol);
|
|
}
|
|
|
|
}
|