summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Environment.cpp
blob: cfed895af02f425f8ac63f08d05c933bd5d73b2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibJS/Runtime/Environment.h>
#include <LibJS/Runtime/GlobalObject.h>

namespace JS {

Environment::Environment(Environment* outer_environment)
    : m_outer_environment(outer_environment)
{
}

void Environment::visit_edges(Visitor& visitor)
{
    Cell::visit_edges(visitor);
    visitor.visit(m_outer_environment);
}

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();
}

}