aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/CompilerStack.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-09-22 01:43:56 +0800
committerchriseth <c@ethdev.com>2015-09-22 02:03:53 +0800
commit42c0009205852abc2f2d7415a9e5faaf6e5b2d56 (patch)
treed88a500931a153eaa5a10b3fd883aa27652813c4 /libsolidity/CompilerStack.h
parent39d1e2bc06a5c39180681c78e8f6618f25da2bce (diff)
downloaddexon-solidity-42c0009205852abc2f2d7415a9e5faaf6e5b2d56.tar.gz
dexon-solidity-42c0009205852abc2f2d7415a9e5faaf6e5b2d56.tar.zst
dexon-solidity-42c0009205852abc2f2d7415a9e5faaf6e5b2d56.zip
Error formatting.
Diffstat (limited to 'libsolidity/CompilerStack.h')
-rw-r--r--libsolidity/CompilerStack.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/libsolidity/CompilerStack.h b/libsolidity/CompilerStack.h
index 4d9c1ec5..235bdaa2 100644
--- a/libsolidity/CompilerStack.h
+++ b/libsolidity/CompilerStack.h
@@ -54,6 +54,7 @@ class SourceUnit;
class Compiler;
class GlobalContext;
class InterfaceHandler;
+struct Error;
enum class DocumentationType: uint8_t
{
@@ -85,18 +86,21 @@ public:
bool addSource(std::string const& _name, std::string const& _content, bool _isLibrary = false);
void setSource(std::string const& _sourceCode);
/// Parses all source units that were added
- void parse();
+ /// @returns false on error.
+ bool parse();
/// Sets the given source code as the only source unit apart from standard sources and parses it.
- void parse(std::string const& _sourceCode);
+ /// @returns false on error.
+ bool parse(std::string const& _sourceCode);
/// Returns a list of the contract names in the sources.
std::vector<std::string> contractNames() const;
std::string defaultContractName() const;
/// Compiles the source units that were previously added and parsed.
- void compile(bool _optimize = false, unsigned _runs = 200);
+ /// @returns false on error.
+ bool compile(bool _optimize = false, unsigned _runs = 200);
/// Parses and compiles the given source code.
- /// @returns the compiled linker object
- eth::LinkerObject const& compile(std::string const& _sourceCode, bool _optimize = false);
+ /// @returns false on error.
+ bool compile(std::string const& _sourceCode, bool _optimize = false);
/// Inserts the given addresses into the linker objects of all compiled contracts.
void link(std::map<std::string, h160> const& _libraries);
@@ -152,15 +156,14 @@ public:
FunctionDefinition const& _function
) const;
- /// Compile the given @a _sourceCode to bytecode. If a scanner is provided, it is used for
- /// scanning the source code - this is useful for printing exception information.
- static eth::LinkerObject staticCompile(std::string const& _sourceCode, bool _optimize = false);
-
/// 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;
+ /// @returns the list of errors that occured during parsing and type checking.
+ std::vector<std::shared_ptr<Error const>> const& errors() const { return m_errors; }
+
private:
/**
* Information pertaining to one source unit, filled gradually during parsing and compilation.
@@ -200,6 +203,7 @@ private:
std::shared_ptr<GlobalContext> m_globalContext;
std::vector<Source const*> m_sourceOrder;
std::map<std::string const, Contract> m_contracts;
+ std::vector<std::shared_ptr<Error const>> m_errors;
};
}