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

LibJS: Add ScriptOrModule to execution context and track it everywhere

This commit is contained in:
davidot 2022-01-17 14:48:22 +01:00 committed by Linus Groh
parent 99edf5b25a
commit 57c5a59cab
10 changed files with 42 additions and 6 deletions

View file

@ -15,6 +15,8 @@
namespace JS {
using ScriptOrModule = Variant<Empty, Script*, Module*>;
// 9.4 Execution Contexts, https://tc39.es/ecma262/#sec-execution-contexts
struct ExecutionContext {
explicit ExecutionContext(Heap& heap)
@ -28,6 +30,7 @@ struct ExecutionContext {
copy.function = function;
copy.realm = realm;
copy.script_or_module = script_or_module;
copy.lexical_environment = lexical_environment;
copy.variable_environment = variable_environment;
copy.private_environment = private_environment;
@ -48,6 +51,7 @@ private:
public:
FunctionObject* function { nullptr }; // [[Function]]
Realm* realm { nullptr }; // [[Realm]]
ScriptOrModule script_or_module; // [[ScriptOrModule]]
Environment* lexical_environment { nullptr }; // [[LexicalEnvironment]]
Environment* variable_environment { nullptr }; // [[VariableEnvironment]]
PrivateEnvironment* private_environment { nullptr }; // [[PrivateEnvironment]]