summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-08-16 19:28:17 +0100
committerLinus Groh <mail@linusgroh.de>2022-08-23 13:58:30 +0100
commit5398dcc55e1b8279f6b3edf62ad249a27b4f2f64 (patch)
tree5ff1f269368c873e9c9618b55b1b5a1eebbbf4b4 /Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
parente992a9f469a536b5a5442229a1adddd27deb1db9 (diff)
downloadserenity-5398dcc55e1b8279f6b3edf62ad249a27b4f2f64.zip
LibJS: Remove GlobalObject from execute() and related AST functions
This is a continuation of the previous four commits. Passing a global object here is largely redundant, we definitely need the interpreter but can get the VM and (later) current active realm from there - and also the global object while we still need it, although I'd like to remove Interpreter::global_object() in the future. This now matches the bytecode interpreter's execute_impl() functions.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
index 03a7eba4ae..885f904d0b 100644
--- a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <LibJS/Interpreter.h>
#include <LibJS/Lexer.h>
#include <LibJS/Parser.h>
#include <LibJS/Runtime/AbstractOperations.h>
@@ -173,9 +174,12 @@ ThrowCompletionOr<Value> perform_shadow_realm_eval(GlobalObject& global_object,
// 17. If result.[[Type]] is normal, then
if (!eval_result.is_throw_completion()) {
+ // FIXME: Remove once everything uses the VM's current realm.
+ auto eval_realm_interpreter = Interpreter::create_with_existing_realm(eval_realm);
+
// TODO: Optionally use bytecode interpreter?
// a. Set result to the result of evaluating body.
- result = program->execute(vm.interpreter(), eval_realm.global_object());
+ result = program->execute(*eval_realm_interpreter);
}
// 18. If result.[[Type]] is normal and result.[[Value]] is empty, then