1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09: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:
Linus Groh 2022-08-16 19:28:17 +01:00
parent e992a9f469
commit 5398dcc55e
Notes: sideshowbarker 2024-07-17 20:58:35 +09:00
10 changed files with 409 additions and 357 deletions

View file

@ -80,13 +80,13 @@ ThrowCompletionOr<Value> Interpreter::run(Script& script_record)
auto& script = script_record.parse_node();
// 12. Let result be Completion(GlobalDeclarationInstantiation(script, globalEnv)).
auto instantiation_result = script.global_declaration_instantiation(*this, global_object, global_environment);
auto instantiation_result = script.global_declaration_instantiation(*this, global_environment);
Completion result = instantiation_result.is_throw_completion() ? instantiation_result.throw_completion() : normal_completion({});
// 13. If result.[[Type]] is normal, then
if (result.type() == Completion::Type::Normal) {
// a. Set result to the result of evaluating script.
result = script.execute(*this, global_object);
result = script.execute(*this);
}
// 14. If result.[[Type]] is normal and result.[[Value]] is empty, then