2021-06-21 23:17:24 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2020-2022, Andreas Kling <andreas@ladybird.org>
|
2021-06-21 23:17:24 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2021-07-01 12:24:46 +02:00
|
|
|
#include <LibJS/Runtime/Environment.h>
|
2021-09-11 14:09:05 +02:00
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
2021-06-21 23:17:24 +02:00
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
2024-05-11 13:31:33 +02:00
|
|
|
Environment::Environment(Environment* outer_environment, IsDeclarative is_declarative)
|
|
|
|
: m_declarative(is_declarative == IsDeclarative::Yes)
|
|
|
|
, m_outer_environment(outer_environment)
|
2021-06-21 23:17:24 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-07-01 12:24:46 +02:00
|
|
|
void Environment::visit_edges(Visitor& visitor)
|
2021-06-21 23:17:24 +02:00
|
|
|
{
|
2023-03-20 13:37:11 -07:00
|
|
|
Base::visit_edges(visitor);
|
2021-06-21 23:35:30 +02:00
|
|
|
visitor.visit(m_outer_environment);
|
2021-06-21 23:17:24 +02:00
|
|
|
}
|
|
|
|
|
2021-10-07 11:36:44 +02: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 23:17:24 +02:00
|
|
|
}
|