LibJS: Make GlobalDeclarationInstantiation take a VM&

This doesn't need to take an AST Interpreter&.
This commit is contained in:
Andreas Kling 2023-06-15 10:37:42 +02:00
parent 872d798951
commit 32d9c8e3ca
Notes: sideshowbarker 2024-07-17 07:19:27 +09:00
3 changed files with 3 additions and 4 deletions

View file

@ -4760,9 +4760,8 @@ void ScopeNode::block_declaration_instantiation(Interpreter& interpreter, Enviro
}
// 16.1.7 GlobalDeclarationInstantiation ( script, env ), https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& interpreter, GlobalEnvironment& global_environment) const
ThrowCompletionOr<void> Program::global_declaration_instantiation(VM& vm, GlobalEnvironment& global_environment) const
{
auto& vm = interpreter.vm();
auto& realm = *vm.current_realm();
// 1. Let lexNames be the LexicallyDeclaredNames of script.

View file

@ -537,7 +537,7 @@ public:
bool has_top_level_await() const { return m_has_top_level_await; }
void set_has_top_level_await() { m_has_top_level_await = true; }
ThrowCompletionOr<void> global_declaration_instantiation(Interpreter&, GlobalEnvironment&) const;
ThrowCompletionOr<void> global_declaration_instantiation(VM&, GlobalEnvironment&) const;
private:
virtual bool is_program() const override { return true; }

View file

@ -80,7 +80,7 @@ ThrowCompletionOr<Value> Interpreter::run(Script& script_record, JS::GCPtr<Envir
auto& script = script_record.parse_node();
// 12. Let result be Completion(GlobalDeclarationInstantiation(script, globalEnv)).
auto instantiation_result = script.global_declaration_instantiation(*this, global_environment);
auto instantiation_result = script.global_declaration_instantiation(vm, global_environment);
Completion result = instantiation_result.is_throw_completion() ? instantiation_result.throw_completion() : normal_completion({});
// 13. If result.[[Type]] is normal, then