mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:17:45 +00:00
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.
This commit is contained in:
parent
e992a9f469
commit
5398dcc55e
10 changed files with 409 additions and 357 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue