mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:55:09 +00:00

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.
24 lines
513 B
C++
24 lines
513 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)
|
|
: Object(vm().environment_record_shape())
|
|
, m_outer_environment(outer_environment)
|
|
{
|
|
}
|
|
|
|
void EnvironmentRecord::visit_edges(Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(m_outer_environment);
|
|
}
|
|
|
|
}
|