2021-06-21 18:17:24 -03:00
|
|
|
/*
|
2022-01-31 09:00:02 -03:00
|
|
|
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
2021-06-21 18:17:24 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2021-07-01 07:24:46 -03:00
|
|
|
#include <LibJS/Runtime/Environment.h>
|
2021-09-11 09:09:05 -03:00
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
2021-06-21 18:17:24 -03:00
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
2021-07-01 07:24:46 -03:00
|
|
|
Environment::Environment(Environment* outer_environment)
|
2021-06-23 08:04:52 -03:00
|
|
|
: m_outer_environment(outer_environment)
|
2021-06-21 18:17:24 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-01 07:24:46 -03:00
|
|
|
void Environment::visit_edges(Visitor& visitor)
|
2021-06-21 18:17:24 -03:00
|
|
|
{
|
2023-03-20 17:37:11 -03:00
|
|
|
Base::visit_edges(visitor);
|
2021-06-21 18:35:30 -03:00
|
|
|
visitor.visit(m_outer_environment);
|
2021-06-21 18:17:24 -03:00
|
|
|
}
|
|
|
|
|
|
2021-10-07 06:36:44 -03:00
|
|
|
void Environment::set_permanently_screwed_by_eval()
|
|
|
|
|
{
|
|
|
|
|
if (m_permanently_screwed_by_eval)
|
|
|
|
|
return;
|
|
|
|
|
m_permanently_screwed_by_eval = true;
|
|
|
|
|
if (outer_environment())
|
|
|
|
|
outer_environment()->set_permanently_screwed_by_eval();
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 18:17:24 -03:00
|
|
|
}
|