diff options
author | Rhett Aultman <roadriverrail@gmail.com> | 2017-05-11 21:26:35 +0800 |
---|---|---|
committer | Rhett Aultman <roadriverrail@gmail.com> | 2017-05-30 22:28:31 +0800 |
commit | 89b60ffbd4c2dde26fa5e9f1d750729b5c89373e (patch) | |
tree | a4c464d4d40baaa260f071c1028f347bd287e44d /libsolidity/inlineasm/AsmStack.cpp | |
parent | 0066a08aa8f6c469cde7947ec50ca662a32123a0 (diff) | |
download | dexon-solidity-89b60ffbd4c2dde26fa5e9f1d750729b5c89373e.tar.gz dexon-solidity-89b60ffbd4c2dde26fa5e9f1d750729b5c89373e.tar.zst dexon-solidity-89b60ffbd4c2dde26fa5e9f1d750729b5c89373e.zip |
Refactor error reporting
This commit introduces ErrorReporter, a utility class which consolidates
all of the error logging functionality into a common set of functions.
It also replaces all direct interactions with an ErrorList with calls to
an ErrorReporter.
This commit resolves issue #2209
Diffstat (limited to 'libsolidity/inlineasm/AsmStack.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmStack.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libsolidity/inlineasm/AsmStack.cpp b/libsolidity/inlineasm/AsmStack.cpp index fe443c08..73b1604d 100644 --- a/libsolidity/inlineasm/AsmStack.cpp +++ b/libsolidity/inlineasm/AsmStack.cpp @@ -46,14 +46,14 @@ bool InlineAssemblyStack::parse( ) { m_parserResult = make_shared<Block>(); - Parser parser(m_errors); + Parser parser(m_errorReporter); auto result = parser.parse(_scanner); if (!result) return false; *m_parserResult = std::move(*result); AsmAnalysisInfo analysisInfo; - return (AsmAnalyzer(analysisInfo, m_errors, false, _resolver)).analyze(*m_parserResult); + return (AsmAnalyzer(analysisInfo, m_errorReporter, false, _resolver)).analyze(*m_parserResult); } string InlineAssemblyStack::toString() @@ -64,9 +64,9 @@ string InlineAssemblyStack::toString() eth::Assembly InlineAssemblyStack::assemble() { AsmAnalysisInfo analysisInfo; - AsmAnalyzer analyzer(analysisInfo, m_errors); + AsmAnalyzer analyzer(analysisInfo, m_errorReporter); solAssert(analyzer.analyze(*m_parserResult), ""); - CodeGenerator codeGen(m_errors); + CodeGenerator codeGen(m_errorReporter); return codeGen.assemble(*m_parserResult, analysisInfo); } @@ -77,19 +77,20 @@ bool InlineAssemblyStack::parseAndAssemble( ) { ErrorList errors; + ErrorReporter errorReporter(errors); auto scanner = make_shared<Scanner>(CharStream(_input), "--CODEGEN--"); - auto parserResult = Parser(errors).parse(scanner); - if (!errors.empty()) + auto parserResult = Parser(errorReporter).parse(scanner); + if (!errorReporter.errors().empty()) return false; solAssert(parserResult, ""); AsmAnalysisInfo analysisInfo; - AsmAnalyzer analyzer(analysisInfo, errors, false, _identifierAccess.resolve); + AsmAnalyzer analyzer(analysisInfo, errorReporter, false, _identifierAccess.resolve); solAssert(analyzer.analyze(*parserResult), ""); - CodeGenerator(errors).assemble(*parserResult, analysisInfo, _assembly, _identifierAccess); + CodeGenerator(errorReporter).assemble(*parserResult, analysisInfo, _assembly, _identifierAccess); // At this point, the assembly might be messed up, but we should throw an // internal compiler error anyway. - return errors.empty(); + return errorReporter.errors().empty(); } |