/src/solidity/libsolidity/experimental/codegen/IRGenerationContext.h
Line | Count | Source |
1 | | /* |
2 | | This file is part of solidity. |
3 | | |
4 | | solidity is free software: you can redistribute it and/or modify |
5 | | it under the terms of the GNU General Public License as published by |
6 | | the Free Software Foundation, either version 3 of the License, or |
7 | | (at your option) any later version. |
8 | | |
9 | | solidity is distributed in the hope that it will be useful, |
10 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | GNU General Public License for more details. |
13 | | |
14 | | You should have received a copy of the GNU General Public License |
15 | | along with solidity. If not, see <http://www.gnu.org/licenses/>. |
16 | | */ |
17 | | // SPDX-License-Identifier: GPL-3.0 |
18 | | |
19 | | #pragma once |
20 | | |
21 | | #include <libsolidity/ast/ASTForward.h> |
22 | | |
23 | | #include <libsolidity/experimental/analysis/Analysis.h> |
24 | | #include <libsolidity/experimental/ast/TypeSystem.h> |
25 | | |
26 | | #include <list> |
27 | | #include <set> |
28 | | |
29 | | namespace solidity::frontend::experimental |
30 | | { |
31 | | |
32 | | class Analysis; |
33 | | |
34 | | struct IRGenerationContext |
35 | | { |
36 | | Analysis const& analysis; |
37 | | TypeEnvironment const* env = nullptr; |
38 | | void enqueueFunctionDefinition(FunctionDefinition const* _functionDefinition, Type _type) |
39 | 0 | { |
40 | 0 | QueuedFunction queue{_functionDefinition, env->resolve(_type)}; |
41 | 0 | for (auto type: generatedFunctions[_functionDefinition]) |
42 | 0 | if (env->typeEquals(type, _type)) |
43 | 0 | return; |
44 | 0 | functionQueue.emplace_back(queue); |
45 | 0 | } |
46 | | struct QueuedFunction |
47 | | { |
48 | | FunctionDefinition const* function = nullptr; |
49 | | Type type = std::monostate{}; |
50 | | }; |
51 | | std::list<QueuedFunction> functionQueue; |
52 | | std::map<FunctionDefinition const*, std::vector<Type>> generatedFunctions; |
53 | | }; |
54 | | |
55 | | } |