aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/CompilerStack.h
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2018-11-15 00:11:55 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-11-22 03:13:44 +0800
commitd67322a1861d60a88151f7c25d6c3478a9a39acf (patch)
treeaf485e48c3436cd24e2db09a6a1bcf445605bae1 /libsolidity/interface/CompilerStack.h
parent80371e2d25ce3eb868d6f75b99a54af9dc6c1583 (diff)
downloaddexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.gz
dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.tar.zst
dexon-solidity-d67322a1861d60a88151f7c25d6c3478a9a39acf.zip
Introduce namespace `langutil` in liblangutil directory.
Also: - Use {}-style list initialisation for SourceLocation construction - Introduce new system includes - Changes the API of the Scanner to take source as value (with move) as opposed to as a reference
Diffstat (limited to 'libsolidity/interface/CompilerStack.h')
-rw-r--r--libsolidity/interface/CompilerStack.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index a7e312ad..8c50266e 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -23,11 +23,12 @@
#pragma once
-#include <liblangutil/ErrorReporter.h>
#include <libsolidity/interface/ReadFile.h>
-#include <liblangutil/EVMVersion.h>
+#include <liblangutil/ErrorReporter.h>
+#include <liblangutil/EVMVersion.h>
#include <liblangutil/SourceLocation.h>
+
#include <libevmasm/LinkerObject.h>
#include <libdevcore/Common.h>
@@ -43,6 +44,11 @@
#include <vector>
#include <functional>
+namespace langutil
+{
+class Scanner;
+}
+
namespace dev
{
@@ -57,7 +63,6 @@ namespace solidity
{
// forward declarations
-class Scanner;
class ASTNode;
class ContractDefinition;
class FunctionDefinition;
@@ -65,7 +70,6 @@ class SourceUnit;
class Compiler;
class GlobalContext;
class Natspec;
-class Error;
class DeclarationContainer;
/**
@@ -100,7 +104,7 @@ public:
m_errorReporter(m_errorList) {}
/// @returns the list of errors that occurred during parsing and type checking.
- ErrorList const& errors() const { return m_errorReporter.errors(); }
+ langutil::ErrorList const& errors() const { return m_errorReporter.errors(); }
/// @returns the current state.
State state() const { return m_stackState; }
@@ -174,7 +178,7 @@ public:
std::map<std::string, unsigned> sourceIndices() const;
/// @returns the previously used scanner, useful for counting lines during error reporting.
- Scanner const& scanner(std::string const& _sourceName) const;
+ langutil::Scanner const& scanner(std::string const& _sourceName) const;
/// @returns the parsed source unit with the supplied name.
SourceUnit const& ast(std::string const& _sourceName) const;
@@ -182,7 +186,7 @@ public:
/// Helper function for logs printing. Do only use in error cases, it's quite expensive.
/// line and columns are numbered starting from 1 with following order:
/// start line, start column, end line, end column
- std::tuple<int, int, int, int> positionFromSourceLocation(SourceLocation const& _sourceLocation) const;
+ std::tuple<int, int, int, int> positionFromSourceLocation(langutil::SourceLocation const& _sourceLocation) const;
/// @returns a list of the contract names in the sources.
std::vector<std::string> contractNames() const;
@@ -248,7 +252,7 @@ private:
/// The state per source unit. Filled gradually during parsing.
struct Source
{
- std::shared_ptr<Scanner> scanner;
+ std::shared_ptr<langutil::Scanner> scanner;
std::shared_ptr<SourceUnit> ast;
bool isLibrary = false;
void reset() { scanner.reset(); ast.reset(); }
@@ -345,8 +349,8 @@ private:
/// This is updated during compilation.
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>> m_scopes;
std::map<std::string const, Contract> m_contracts;
- ErrorList m_errorList;
- ErrorReporter m_errorReporter;
+ langutil::ErrorList m_errorList;
+ langutil::ErrorReporter m_errorReporter;
bool m_metadataLiteralSources = false;
State m_stackState = Empty;
};