1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibJS: Move the GlobalEnvironment from GlobalObject to Realm

This is where the spec wants to have it. Requires a couple of hacks as
currently everything that needs a Realm actually has a GlobalObject, so
we need to go via the Interpreter.
This commit is contained in:
Linus Groh 2021-09-11 20:27:36 +01:00
parent 1e79934acf
commit f29a82dd84
6 changed files with 13 additions and 16 deletions

View file

@ -399,7 +399,7 @@ Value perform_eval(Value x, GlobalObject& caller_realm, CallerMode strict_caller
if (direct == EvalMode::Direct)
return interpreter.execute_statement(caller_realm, program).value_or(js_undefined());
TemporaryChange scope_change(vm.running_execution_context().lexical_environment, static_cast<Environment*>(&caller_realm.environment()));
TemporaryChange scope_change(vm.running_execution_context().lexical_environment, static_cast<Environment*>(&interpreter.realm().global_environment()));
TemporaryChange scope_change_strict(vm.running_execution_context().is_strict_mode, strict_caller == CallerMode::Strict);
return interpreter.execute_statement(caller_realm, program).value_or(js_undefined());
}