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

LibJS: Make EnvironmentRecord inherit directly from Cell

Previously, EnvironmentRecord was a JS::Object. This was done because
GlobalObject inherited from EnvironmentRecord. Now that this is no
longer the case, we can simplify things by making EnvironmentRecord
inherit from Cell directly.

This also removes the need for environment records to have a shape,
which was awkward. This will be removed in the following patch.
This commit is contained in:
Andreas Kling 2021-06-23 13:04:52 +02:00
parent 7a87e920f2
commit 9ccc2f6c4d
8 changed files with 25 additions and 18 deletions

View file

@ -10,20 +10,19 @@
namespace JS {
EnvironmentRecord::EnvironmentRecord(EnvironmentRecord* outer_environment)
: Object(vm().environment_record_shape())
, m_outer_environment(outer_environment)
: m_outer_environment(outer_environment)
{
}
void EnvironmentRecord::initialize(GlobalObject& global_object)
{
m_global_object = &global_object;
Base::initialize(global_object);
Cell::initialize(global_object);
}
void EnvironmentRecord::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
Cell::visit_edges(visitor);
visitor.visit(m_outer_environment);
}