/src/serenity/Userland/Libraries/LibJS/Runtime/Environment.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibJS/Runtime/Environment.h> |
8 | | #include <LibJS/Runtime/GlobalObject.h> |
9 | | |
10 | | namespace JS { |
11 | | |
12 | | Environment::Environment(Environment* outer_environment, IsDeclarative is_declarative) |
13 | 0 | : m_declarative(is_declarative == IsDeclarative::Yes) |
14 | 0 | , m_outer_environment(outer_environment) |
15 | 0 | { |
16 | 0 | } |
17 | | |
18 | | void Environment::visit_edges(Visitor& visitor) |
19 | 0 | { |
20 | 0 | Base::visit_edges(visitor); |
21 | 0 | visitor.visit(m_outer_environment); |
22 | 0 | } |
23 | | |
24 | | void Environment::set_permanently_screwed_by_eval() |
25 | 0 | { |
26 | 0 | if (m_permanently_screwed_by_eval) |
27 | 0 | return; |
28 | 0 | m_permanently_screwed_by_eval = true; |
29 | 0 | if (outer_environment()) |
30 | 0 | outer_environment()->set_permanently_screwed_by_eval(); |
31 | 0 | } |
32 | | |
33 | | } |