Coverage Report

Created: 2022-08-24 06:31

/src/solidity/libyul/optimiser/Substitution.h
Line
Count
Source (jump to first uncovered line)
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
 * Specific AST copier that replaces certain identifiers with expressions.
20
 */
21
22
#pragma once
23
24
#include <libyul/optimiser/ASTCopier.h>
25
#include <libyul/YulString.h>
26
27
#include <map>
28
29
namespace solidity::yul
30
{
31
32
/**
33
 * Specific AST copier that replaces certain identifiers with expressions.
34
 */
35
class Substitution: public ASTCopier
36
{
37
public:
38
  Substitution(std::map<YulString, Expression const*> const& _substitutions):
39
    m_substitutions(_substitutions)
40
0
  {}
41
  Expression translate(Expression const& _expression) override;
42
43
private:
44
  std::map<YulString, Expression const*> const& m_substitutions;
45
};
46
47
}