
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.
29 lines
611 B
C++
29 lines
611 B
C++
/*
|
|
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Runtime/EnvironmentRecord.h>
|
|
#include <LibJS/Runtime/VM.h>
|
|
|
|
namespace JS {
|
|
|
|
EnvironmentRecord::EnvironmentRecord(EnvironmentRecord* outer_environment)
|
|
: m_outer_environment(outer_environment)
|
|
{
|
|
}
|
|
|
|
void EnvironmentRecord::initialize(GlobalObject& global_object)
|
|
{
|
|
m_global_object = &global_object;
|
|
Cell::initialize(global_object);
|
|
}
|
|
|
|
void EnvironmentRecord::visit_edges(Visitor& visitor)
|
|
{
|
|
Cell::visit_edges(visitor);
|
|
visitor.visit(m_outer_environment);
|
|
}
|
|
|
|
}
|