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

LibJS: Rename Environment Records so they match the spec :^)

This patch makes the following name changes:

- ScopeObject => EnvironmentRecord
- LexicalEnvironment => DeclarativeEnvironmentRecord
- WithScope => ObjectEnvironmentRecord
This commit is contained in:
Andreas Kling 2021-06-21 23:17:24 +02:00
parent e9b4a0a830
commit 6c6dbcfc36
35 changed files with 297 additions and 297 deletions

View file

@ -13,7 +13,7 @@
namespace JS {
GeneratorObject* GeneratorObject::create(GlobalObject& global_object, Value initial_value, ScriptFunction* generating_function, ScopeObject* generating_scope, Bytecode::RegisterWindow frame)
GeneratorObject* GeneratorObject::create(GlobalObject& global_object, Value initial_value, ScriptFunction* generating_function, EnvironmentRecord* generating_scope, Bytecode::RegisterWindow frame)
{
// This is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png)
auto generating_function_proto_property = generating_function->get(global_object.vm().names.prototype).to_object(global_object);
@ -22,7 +22,7 @@ GeneratorObject* GeneratorObject::create(GlobalObject& global_object, Value init
auto object = global_object.heap().allocate<GeneratorObject>(global_object, global_object, *generating_function_proto_property);
object->m_generating_function = generating_function;
object->m_scope = generating_scope;
object->m_environment_record = generating_scope;
object->m_frame = move(frame);
object->m_previous_value = initial_value;
return object;
@ -44,7 +44,7 @@ GeneratorObject::~GeneratorObject()
void GeneratorObject::visit_edges(Cell::Visitor& visitor)
{
Object::visit_edges(visitor);
visitor.visit(m_scope);
visitor.visit(m_environment_record);
visitor.visit(m_generating_function);
if (m_previous_value.is_object())
visitor.visit(&m_previous_value.as_object());
@ -106,8 +106,8 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
bytecode_interpreter->accumulator() = vm.argument(0);
}
// Temporarily switch to the captured scope
TemporaryChange change { vm.call_frame().scope, m_scope };
// Temporarily switch to the captured environment record
TemporaryChange change { vm.call_frame().environment_record, m_environment_record };
m_previous_value = bytecode_interpreter->run(*m_generating_function->bytecode_executable(), next_block);