1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:45:09 +00:00

LibJS: Split the per-call-frame environment into lexical and variable

To better follow the spec, we need to distinguish between the current
execution context's lexical environment and variable environment.

This patch moves us to having two record pointers, although both of
them point at the same environment records for now.
This commit is contained in:
Andreas Kling 2021-06-22 15:42:44 +02:00
parent aabd82d508
commit 1d20380859
13 changed files with 52 additions and 41 deletions

View file

@ -166,7 +166,7 @@ Value ScriptFunction::execute_function_body()
if (i >= call_frame_args.size())
call_frame_args.resize(i + 1);
call_frame_args[i] = argument_value;
vm.assign(param, argument_value, global_object(), true, vm.current_environment_record());
vm.assign(param, argument_value, global_object(), true, vm.lexical_environment());
});
if (vm.exception())
@ -191,7 +191,7 @@ Value ScriptFunction::execute_function_body()
if (m_kind != FunctionKind::Generator)
return result;
return GeneratorObject::create(global_object(), result, this, vm.call_frame().environment_record, bytecode_interpreter->snapshot_frame());
return GeneratorObject::create(global_object(), result, this, vm.call_frame().lexical_environment, bytecode_interpreter->snapshot_frame());
} else {
VERIFY(m_kind != FunctionKind::Generator);
OwnPtr<Interpreter> local_interpreter;