
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().
29 lines
659 B
C++
29 lines
659 B
C++
/*
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Heap/Heap.h>
|
|
#include <LibJS/Runtime/Symbol.h>
|
|
#include <LibJS/Runtime/VM.h>
|
|
|
|
namespace JS {
|
|
|
|
Symbol::Symbol(Optional<String> description, bool is_global)
|
|
: m_description(move(description))
|
|
, m_is_global(is_global)
|
|
{
|
|
}
|
|
|
|
Symbol* js_symbol(Heap& heap, Optional<String> description, bool is_global)
|
|
{
|
|
return heap.allocate_without_realm<Symbol>(move(description), is_global);
|
|
}
|
|
|
|
Symbol* js_symbol(VM& vm, Optional<String> description, bool is_global)
|
|
{
|
|
return js_symbol(vm.heap(), move(description), is_global);
|
|
}
|
|
|
|
}
|