mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibJS: Remove {Bytecode::,}Interpreter::global_object()
The basic idea is that a global object cannot just come out of nowhere, it must be associated to a realm - so get it from there, if needed. This is to enforce the changes from all the previous commits by not handing out global objects unless you actually have an initialized realm (either stored somewhere, or the VM's current realm).
This commit is contained in:
@@ -25,7 +25,6 @@ NonnullOwnPtr<Interpreter> Interpreter::create_with_existing_realm(Realm& realm)
|
||||
auto& vm = realm.vm();
|
||||
DeferGC defer_gc(vm.heap());
|
||||
auto interpreter = adopt_own(*new Interpreter(vm));
|
||||
interpreter->m_global_object = make_handle(&realm.global_object());
|
||||
interpreter->m_realm = make_handle(&realm);
|
||||
return interpreter;
|
||||
}
|
||||
@@ -140,16 +139,6 @@ ThrowCompletionOr<Value> Interpreter::run(SourceTextModule& module)
|
||||
return js_undefined();
|
||||
}
|
||||
|
||||
GlobalObject& Interpreter::global_object()
|
||||
{
|
||||
return static_cast<GlobalObject&>(*m_global_object.cell());
|
||||
}
|
||||
|
||||
GlobalObject const& Interpreter::global_object() const
|
||||
{
|
||||
return static_cast<GlobalObject const&>(*m_global_object.cell());
|
||||
}
|
||||
|
||||
Realm& Interpreter::realm()
|
||||
{
|
||||
return static_cast<Realm&>(*m_realm.cell());
|
||||
|
||||
Reference in New Issue
Block a user