aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/ConstantEvaluator.h10
-rw-r--r--libsolidity/analysis/ControlFlowAnalyzer.cpp2
-rw-r--r--libsolidity/analysis/ControlFlowAnalyzer.h4
-rw-r--r--libsolidity/analysis/ControlFlowGraph.cpp3
-rw-r--r--libsolidity/analysis/ControlFlowGraph.h4
-rw-r--r--libsolidity/analysis/DocStringAnalyser.cpp1
-rw-r--r--libsolidity/analysis/DocStringAnalyser.h11
-rw-r--r--libsolidity/analysis/NameAndTypeResolver.cpp7
-rw-r--r--libsolidity/analysis/NameAndTypeResolver.h19
-rw-r--r--libsolidity/analysis/PostTypeChecker.cpp1
-rw-r--r--libsolidity/analysis/PostTypeChecker.h14
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp10
-rw-r--r--libsolidity/analysis/ReferencesResolver.h19
-rw-r--r--libsolidity/analysis/SemVerHandler.h3
-rw-r--r--libsolidity/analysis/StaticAnalyzer.cpp1
-rw-r--r--libsolidity/analysis/StaticAnalyzer.h9
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp1
-rw-r--r--libsolidity/analysis/SyntaxChecker.h9
-rw-r--r--libsolidity/analysis/TypeChecker.cpp1
-rw-r--r--libsolidity/analysis/TypeChecker.h11
-rw-r--r--libsolidity/analysis/ViewPureChecker.cpp3
-rw-r--r--libsolidity/analysis/ViewPureChecker.h20
22 files changed, 109 insertions, 54 deletions
diff --git a/libsolidity/analysis/ConstantEvaluator.h b/libsolidity/analysis/ConstantEvaluator.h
index ac3a24a1..23ca3628 100644
--- a/libsolidity/analysis/ConstantEvaluator.h
+++ b/libsolidity/analysis/ConstantEvaluator.h
@@ -24,12 +24,16 @@
#include <libsolidity/ast/ASTVisitor.h>
+namespace langutil
+{
+class ErrorReporter;
+}
+
namespace dev
{
namespace solidity
{
-class ErrorReporter;
class TypeChecker;
/**
@@ -39,7 +43,7 @@ class ConstantEvaluator: private ASTConstVisitor
{
public:
ConstantEvaluator(
- ErrorReporter& _errorReporter,
+ langutil::ErrorReporter& _errorReporter,
size_t _newDepth = 0,
std::shared_ptr<std::map<ASTNode const*, TypePointer>> _types = std::make_shared<std::map<ASTNode const*, TypePointer>>()
):
@@ -61,7 +65,7 @@ private:
void setType(ASTNode const& _node, TypePointer const& _type);
TypePointer type(ASTNode const& _node);
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
/// Current recursion depth.
size_t m_depth = 0;
std::shared_ptr<std::map<ASTNode const*, TypePointer>> m_types;
diff --git a/libsolidity/analysis/ControlFlowAnalyzer.cpp b/libsolidity/analysis/ControlFlowAnalyzer.cpp
index 8a608552..fe58f0aa 100644
--- a/libsolidity/analysis/ControlFlowAnalyzer.cpp
+++ b/libsolidity/analysis/ControlFlowAnalyzer.cpp
@@ -16,8 +16,10 @@
*/
#include <libsolidity/analysis/ControlFlowAnalyzer.h>
+#include <liblangutil/SourceLocation.h>
using namespace std;
+using namespace langutil;
using namespace dev::solidity;
bool ControlFlowAnalyzer::analyze(ASTNode const& _astRoot)
diff --git a/libsolidity/analysis/ControlFlowAnalyzer.h b/libsolidity/analysis/ControlFlowAnalyzer.h
index aaaf1bff..411d57ff 100644
--- a/libsolidity/analysis/ControlFlowAnalyzer.h
+++ b/libsolidity/analysis/ControlFlowAnalyzer.h
@@ -29,7 +29,7 @@ namespace solidity
class ControlFlowAnalyzer: private ASTConstVisitor
{
public:
- explicit ControlFlowAnalyzer(CFG const& _cfg, ErrorReporter& _errorReporter):
+ explicit ControlFlowAnalyzer(CFG const& _cfg, langutil::ErrorReporter& _errorReporter):
m_cfg(_cfg), m_errorReporter(_errorReporter) {}
bool analyze(ASTNode const& _astRoot);
@@ -45,7 +45,7 @@ private:
) const;
CFG const& m_cfg;
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
};
}
diff --git a/libsolidity/analysis/ControlFlowGraph.cpp b/libsolidity/analysis/ControlFlowGraph.cpp
index 9b3da0eb..b8860158 100644
--- a/libsolidity/analysis/ControlFlowGraph.cpp
+++ b/libsolidity/analysis/ControlFlowGraph.cpp
@@ -23,6 +23,7 @@
#include <algorithm>
using namespace std;
+using namespace langutil;
using namespace dev::solidity;
bool CFG::constructFlow(ASTNode const& _astRoot)
@@ -133,4 +134,4 @@ void CFG::applyModifierFlowToFunctionFlow(
_functionFlow->entry = copySrcToCopyDst[_modifierFlow.entry];
_functionFlow->exit = copySrcToCopyDst[_modifierFlow.exit];
-} \ No newline at end of file
+}
diff --git a/libsolidity/analysis/ControlFlowGraph.h b/libsolidity/analysis/ControlFlowGraph.h
index 257ce07f..8fe9fe8e 100644
--- a/libsolidity/analysis/ControlFlowGraph.h
+++ b/libsolidity/analysis/ControlFlowGraph.h
@@ -101,7 +101,7 @@ struct ModifierFlow: FunctionFlow
class CFG: private ASTConstVisitor
{
public:
- explicit CFG(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
+ explicit CFG(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
bool constructFlow(ASTNode const& _astRoot);
@@ -133,7 +133,7 @@ private:
FunctionFlow* _functionFlow
);
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
/// Node container.
/// All nodes allocated during the construction of the control flow graph
diff --git a/libsolidity/analysis/DocStringAnalyser.cpp b/libsolidity/analysis/DocStringAnalyser.cpp
index f91d72f0..69a7a43c 100644
--- a/libsolidity/analysis/DocStringAnalyser.cpp
+++ b/libsolidity/analysis/DocStringAnalyser.cpp
@@ -28,6 +28,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
bool DocStringAnalyser::analyseDocStrings(SourceUnit const& _sourceUnit)
diff --git a/libsolidity/analysis/DocStringAnalyser.h b/libsolidity/analysis/DocStringAnalyser.h
index 82746207..f6b236db 100644
--- a/libsolidity/analysis/DocStringAnalyser.h
+++ b/libsolidity/analysis/DocStringAnalyser.h
@@ -25,13 +25,16 @@
#include <libsolidity/ast/ASTVisitor.h>
+namespace langutil
+{
+class ErrorReporter;
+}
+
namespace dev
{
namespace solidity
{
-class ErrorReporter;
-
/**
* Parses and analyses the doc strings.
* Stores the parsing results in the AST annotations and reports errors.
@@ -39,7 +42,7 @@ class ErrorReporter;
class DocStringAnalyser: private ASTConstVisitor
{
public:
- DocStringAnalyser(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
+ DocStringAnalyser(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
bool analyseDocStrings(SourceUnit const& _sourceUnit);
private:
@@ -75,7 +78,7 @@ private:
void appendError(std::string const& _description);
bool m_errorOccured = false;
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
};
}
diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp
index a6c746ed..e40a2c97 100644
--- a/libsolidity/analysis/NameAndTypeResolver.cpp
+++ b/libsolidity/analysis/NameAndTypeResolver.cpp
@@ -30,6 +30,7 @@
#include <boost/algorithm/string.hpp>
using namespace std;
+using namespace langutil;
namespace dev
{
@@ -59,7 +60,7 @@ bool NameAndTypeResolver::registerDeclarations(SourceUnit& _sourceUnit, ASTNode
{
DeclarationRegistrationHelper registrar(m_scopes, _sourceUnit, m_errorReporter, _currentScope);
}
- catch (FatalError const&)
+ catch (langutil::FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
@@ -129,7 +130,7 @@ bool NameAndTypeResolver::resolveNamesAndTypes(ASTNode& _node, bool _resolveInsi
{
return resolveNamesAndTypesInternal(_node, _resolveInsideCode);
}
- catch (FatalError const&)
+ catch (langutil::FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
@@ -144,7 +145,7 @@ bool NameAndTypeResolver::updateDeclaration(Declaration const& _declaration)
m_scopes[nullptr]->registerDeclaration(_declaration, nullptr, false, true);
solAssert(_declaration.scope() == nullptr, "Updated declaration outside global scope.");
}
- catch (FatalError const&)
+ catch (langutil::FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h
index a72c21e3..1b034ef4 100644
--- a/libsolidity/analysis/NameAndTypeResolver.h
+++ b/libsolidity/analysis/NameAndTypeResolver.h
@@ -30,13 +30,16 @@
#include <libsolidity/ast/ASTVisitor.h>
#include <libsolidity/ast/ASTAnnotations.h>
+namespace langutil
+{
+class ErrorReporter;
+}
+
namespace dev
{
namespace solidity
{
-class ErrorReporter;
-
/**
* Resolves name references, typenames and sets the (explicitly given) types for all variable
* declarations.
@@ -50,7 +53,7 @@ public:
NameAndTypeResolver(
std::vector<Declaration const*> const& _globals,
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>>& _scopes,
- ErrorReporter& _errorReporter
+ langutil::ErrorReporter& _errorReporter
);
/// Registers all declarations found in the AST node, usually a source unit.
/// @returns false in case of error.
@@ -125,7 +128,7 @@ private:
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>>& m_scopes;
DeclarationContainer* m_currentScope = nullptr;
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
};
/**
@@ -142,7 +145,7 @@ public:
DeclarationRegistrationHelper(
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>>& _scopes,
ASTNode& _astRoot,
- ErrorReporter& _errorReporter,
+ langutil::ErrorReporter& _errorReporter,
ASTNode const* _currentScope = nullptr
);
@@ -150,10 +153,10 @@ public:
DeclarationContainer& _container,
Declaration const& _declaration,
std::string const* _name,
- SourceLocation const* _errorLocation,
+ langutil::SourceLocation const* _errorLocation,
bool _warnOnShadow,
bool _inactive,
- ErrorReporter& _errorReporter
+ langutil::ErrorReporter& _errorReporter
);
private:
@@ -194,7 +197,7 @@ private:
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>>& m_scopes;
ASTNode const* m_currentScope = nullptr;
VariableScope* m_currentFunction = nullptr;
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
};
}
diff --git a/libsolidity/analysis/PostTypeChecker.cpp b/libsolidity/analysis/PostTypeChecker.cpp
index 3f45df42..27cbcd45 100644
--- a/libsolidity/analysis/PostTypeChecker.cpp
+++ b/libsolidity/analysis/PostTypeChecker.cpp
@@ -29,6 +29,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
diff --git a/libsolidity/analysis/PostTypeChecker.h b/libsolidity/analysis/PostTypeChecker.h
index 8382948a..e428b81a 100644
--- a/libsolidity/analysis/PostTypeChecker.h
+++ b/libsolidity/analysis/PostTypeChecker.h
@@ -23,13 +23,17 @@
#include <libsolidity/ast/ASTForward.h>
#include <libsolidity/ast/ASTVisitor.h>
+namespace langutil
+{
+class ErrorReporter;
+struct SourceLocation;
+}
+
namespace dev
{
namespace solidity
{
-class ErrorReporter;
-
/**
* This module performs analyses on the AST that are done after type checking and assignments of types:
* - whether there are circular references in constant state variables
@@ -39,13 +43,13 @@ class PostTypeChecker: private ASTConstVisitor
{
public:
/// @param _errorReporter provides the error logging functionality.
- PostTypeChecker(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
+ PostTypeChecker(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
bool check(ASTNode const& _astRoot);
private:
/// Adds a new error to the list of errors.
- void typeError(SourceLocation const& _location, std::string const& _description);
+ void typeError(langutil::SourceLocation const& _location, std::string const& _description);
bool visit(ContractDefinition const& _contract) override;
void endVisit(ContractDefinition const& _contract) override;
@@ -57,7 +61,7 @@ private:
VariableDeclaration const* findCycle(VariableDeclaration const& _startingFrom);
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
VariableDeclaration const* m_currentConstVariable = nullptr;
std::vector<VariableDeclaration const*> m_constVariables; ///< Required for determinism.
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp
index cae92203..7ac3ceff 100644
--- a/libsolidity/analysis/ReferencesResolver.cpp
+++ b/libsolidity/analysis/ReferencesResolver.cpp
@@ -36,9 +36,12 @@
#include <boost/range/adaptor/transformed.hpp>
using namespace std;
-using namespace dev;
-using namespace dev::solidity;
+using namespace langutil;
+namespace dev
+{
+namespace solidity
+{
bool ReferencesResolver::resolve(ASTNode const& _root)
{
@@ -454,3 +457,6 @@ void ReferencesResolver::fatalDeclarationError(SourceLocation const& _location,
m_errorOccurred = true;
m_errorReporter.fatalDeclarationError(_location, _description);
}
+
+}
+}
diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h
index 34dbca96..32c0553f 100644
--- a/libsolidity/analysis/ReferencesResolver.h
+++ b/libsolidity/analysis/ReferencesResolver.h
@@ -28,12 +28,17 @@
#include <libsolidity/ast/ASTVisitor.h>
#include <libsolidity/ast/ASTAnnotations.h>
+namespace langutil
+{
+class ErrorReporter;
+struct SourceLocation;
+}
+
namespace dev
{
namespace solidity
{
-class ErrorReporter;
class NameAndTypeResolver;
/**
@@ -44,7 +49,7 @@ class ReferencesResolver: private ASTConstVisitor
{
public:
ReferencesResolver(
- ErrorReporter& _errorReporter,
+ langutil::ErrorReporter& _errorReporter,
NameAndTypeResolver& _resolver,
bool _resolveInsideCode = false
):
@@ -77,18 +82,18 @@ private:
void endVisit(VariableDeclaration const& _variable) override;
/// Adds a new error to the list of errors.
- void typeError(SourceLocation const& _location, std::string const& _description);
+ void typeError(langutil::SourceLocation const& _location, std::string const& _description);
/// Adds a new error to the list of errors and throws to abort reference resolving.
- void fatalTypeError(SourceLocation const& _location, std::string const& _description);
+ void fatalTypeError(langutil::SourceLocation const& _location, std::string const& _description);
/// Adds a new error to the list of errors.
- void declarationError(SourceLocation const& _location, std::string const& _description);
+ void declarationError(langutil::SourceLocation const& _location, std::string const& _description);
/// Adds a new error to the list of errors and throws to abort reference resolving.
- void fatalDeclarationError(SourceLocation const& _location, std::string const& _description);
+ void fatalDeclarationError(langutil::SourceLocation const& _location, std::string const& _description);
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
NameAndTypeResolver& m_resolver;
/// Stack of return parameters.
std::vector<ParameterList const*> m_returnParameters;
diff --git a/libsolidity/analysis/SemVerHandler.h b/libsolidity/analysis/SemVerHandler.h
index edf4fbd8..80185612 100644
--- a/libsolidity/analysis/SemVerHandler.h
+++ b/libsolidity/analysis/SemVerHandler.h
@@ -22,8 +22,9 @@
#pragma once
+#include <libsolidity/parsing/Token.h>
+#include <string>
#include <vector>
-#include <liblangutil/Token.h>
namespace dev
{
diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp
index 353c1755..38391841 100644
--- a/libsolidity/analysis/StaticAnalyzer.cpp
+++ b/libsolidity/analysis/StaticAnalyzer.cpp
@@ -28,6 +28,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
bool StaticAnalyzer::analyze(SourceUnit const& _sourceUnit)
diff --git a/libsolidity/analysis/StaticAnalyzer.h b/libsolidity/analysis/StaticAnalyzer.h
index f5f3dbce..ff33fa3a 100644
--- a/libsolidity/analysis/StaticAnalyzer.h
+++ b/libsolidity/analysis/StaticAnalyzer.h
@@ -28,6 +28,11 @@
#include <libsolidity/ast/ASTForward.h>
#include <libsolidity/ast/ASTVisitor.h>
+namespace langutil
+{
+class ErrorReporter;
+}
+
namespace dev
{
namespace solidity
@@ -44,7 +49,7 @@ class StaticAnalyzer: private ASTConstVisitor
{
public:
/// @param _errorReporter provides the error logging functionality.
- explicit StaticAnalyzer(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
+ explicit StaticAnalyzer(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
/// Performs static analysis on the given source unit and all of its sub-nodes.
/// @returns true iff all checks passed. Note even if all checks passed, errors() can still contain warnings
@@ -70,7 +75,7 @@ private:
/// @returns the size of this type in storage, including all sub-types.
static bigint structureSizeEstimate(Type const& _type, std::set<StructDefinition const*>& _structsSeen);
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
/// Flag that indicates whether the current contract definition is a library.
bool m_library = false;
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index 9ac0478e..a73d7e5c 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -29,6 +29,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
diff --git a/libsolidity/analysis/SyntaxChecker.h b/libsolidity/analysis/SyntaxChecker.h
index 9e3c4652..c2463955 100644
--- a/libsolidity/analysis/SyntaxChecker.h
+++ b/libsolidity/analysis/SyntaxChecker.h
@@ -23,6 +23,11 @@
#include <libsolidity/ast/ASTForward.h>
#include <libsolidity/ast/ASTVisitor.h>
+namespace langutil
+{
+class ErrorReporter;
+}
+
namespace dev
{
namespace solidity
@@ -39,7 +44,7 @@ class SyntaxChecker: private ASTConstVisitor
{
public:
/// @param _errorReporter provides the error logging functionality.
- SyntaxChecker(ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
+ SyntaxChecker(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}
bool checkSyntax(ASTNode const& _astRoot);
@@ -81,7 +86,7 @@ private:
bool visit(StructDefinition const& _struct) override;
bool visit(Literal const& _literal) override;
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
/// Flag that indicates whether a function modifier actually contains '_'.
bool m_placeholderFound = false;
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 7531da65..69de9f12 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -35,6 +35,7 @@
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
namespace
diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h
index 392a923c..c98a4c7f 100644
--- a/libsolidity/analysis/TypeChecker.h
+++ b/libsolidity/analysis/TypeChecker.h
@@ -29,13 +29,16 @@
#include <libsolidity/ast/ASTForward.h>
#include <libsolidity/ast/ASTVisitor.h>
+namespace langutil
+{
+class ErrorReporter;
+}
+
namespace dev
{
namespace solidity
{
-class ErrorReporter;
-
/**
* The module that performs type analysis on the AST, checks the applicability of operations on
* those types and stores errors for invalid operations.
@@ -45,7 +48,7 @@ class TypeChecker: private ASTConstVisitor
{
public:
/// @param _errorReporter provides the error logging functionality.
- TypeChecker(EVMVersion _evmVersion, ErrorReporter& _errorReporter):
+ TypeChecker(EVMVersion _evmVersion, langutil::ErrorReporter& _errorReporter):
m_evmVersion(_evmVersion),
m_errorReporter(_errorReporter)
{}
@@ -183,7 +186,7 @@ private:
/// Flag indicating whether we are currently inside a StructDefinition.
bool m_insideStruct = false;
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
};
}
diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp
index b0cacc43..3fb4c026 100644
--- a/libsolidity/analysis/ViewPureChecker.cpp
+++ b/libsolidity/analysis/ViewPureChecker.cpp
@@ -22,10 +22,13 @@
#include <libsolidity/inlineasm/AsmData.h>
#include <libsolidity/ast/ExperimentalFeatures.h>
+#include <liblangutil/ErrorReporter.h>
+
#include <functional>
using namespace std;
using namespace dev;
+using namespace langutil;
using namespace dev::solidity;
namespace
diff --git a/libsolidity/analysis/ViewPureChecker.h b/libsolidity/analysis/ViewPureChecker.h
index 9615d04f..fd2432a7 100644
--- a/libsolidity/analysis/ViewPureChecker.h
+++ b/libsolidity/analysis/ViewPureChecker.h
@@ -21,11 +21,15 @@
#include <libsolidity/ast/ASTForward.h>
#include <libsolidity/ast/ASTVisitor.h>
-#include <liblangutil/ErrorReporter.h>
-
#include <map>
#include <memory>
+namespace langutil
+{
+class ErrorReporter;
+struct SourceLocation;
+}
+
namespace dev
{
namespace solidity
@@ -34,7 +38,7 @@ namespace solidity
class ViewPureChecker: private ASTConstVisitor
{
public:
- ViewPureChecker(std::vector<std::shared_ptr<ASTNode>> const& _ast, ErrorReporter& _errorReporter):
+ ViewPureChecker(std::vector<std::shared_ptr<ASTNode>> const& _ast, langutil::ErrorReporter& _errorReporter):
m_ast(_ast), m_errorReporter(_errorReporter) {}
bool check();
@@ -43,7 +47,7 @@ private:
struct MutabilityAndLocation
{
StateMutability mutability;
- SourceLocation location;
+ langutil::SourceLocation location;
};
bool visit(FunctionDefinition const& _funDef) override;
@@ -62,15 +66,15 @@ private:
/// Creates appropriate warnings and errors and sets @a m_currentBestMutability.
void reportMutability(
StateMutability _mutability,
- SourceLocation const& _location,
- boost::optional<SourceLocation> const& _nestedLocation = {}
+ langutil::SourceLocation const& _location,
+ boost::optional<langutil::SourceLocation> const& _nestedLocation = {}
);
std::vector<std::shared_ptr<ASTNode>> const& m_ast;
- ErrorReporter& m_errorReporter;
+ langutil::ErrorReporter& m_errorReporter;
bool m_errors = false;
- MutabilityAndLocation m_bestMutabilityAndLocation = MutabilityAndLocation{StateMutability::Payable, SourceLocation()};
+ MutabilityAndLocation m_bestMutabilityAndLocation = MutabilityAndLocation{StateMutability::Payable, langutil::SourceLocation()};
FunctionDefinition const* m_currentFunction = nullptr;
std::map<ModifierDefinition const*, MutabilityAndLocation> m_inferredMutability;
};