diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-22 17:16:08 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-22 18:44:53 +0200 |
commit | 1f8b6ac3c3ffcdc2f3878486602a7336baaf187e (patch) | |
tree | 5e5150cce6caa9d3b6b1672793815b0f7fa45195 /Userland/Libraries/LibJS/Bytecode | |
parent | 1d203808596071b0891459dc4c9aadea4d9c4d6c (diff) | |
download | serenity-1f8b6ac3c3ffcdc2f3878486602a7336baaf187e.zip |
LibJS: Begin implementing GlobalEnvironmentRecord
These represent the outermost scope in the environment record
hierarchy. The spec says they should be a "composite" of two things:
- An ObjectEnvironmentRecord wrapping the global object
- A DeclarativeEnvironmentRecord for other declarations
It's not yet clear to me how this should work, so this patch only
implements the first part, an object record wrapping the global object.
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 0a9d77240c..988a9c16b7 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -10,6 +10,7 @@ #include <LibJS/Bytecode/Instruction.h> #include <LibJS/Bytecode/Interpreter.h> #include <LibJS/Bytecode/Op.h> +#include <LibJS/Runtime/GlobalEnvironmentRecord.h> #include <LibJS/Runtime/GlobalObject.h> namespace JS::Bytecode { @@ -48,7 +49,8 @@ Value Interpreter::run(Executable const& executable, BasicBlock const* entry_poi global_call_frame.this_value = &global_object(); static FlyString global_execution_context_name = "(*BC* global execution context)"; global_call_frame.function_name = global_execution_context_name; - global_call_frame.lexical_environment = &global_object(); + global_call_frame.lexical_environment = &global_object().environment_record(); + global_call_frame.variable_environment = &global_object().environment_record(); VERIFY(!vm().exception()); // FIXME: How do we know if we're in strict mode? Maybe the Bytecode::Block should know this? // global_call_frame.is_strict_mode = ???; |