2021-06-21 18:17:24 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2020-2022, Andreas Kling <andreas@ladybird.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 {
|
|
|
|
|
|
2024-05-11 08:31:33 -03:00
|
|
|
Environment::Environment(Environment* outer_environment, IsDeclarative is_declarative)
|
|
|
|
|
: m_declarative(is_declarative == IsDeclarative::Yes)
|
|
|
|
|
, 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
|
|
|
}
|