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 /test/libjulia/Parser.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 'test/libjulia/Parser.cpp')
-rw-r--r-- | test/libjulia/Parser.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp index b82c446a..afeb95f8 100644 --- a/test/libjulia/Parser.cpp +++ b/test/libjulia/Parser.cpp @@ -45,16 +45,16 @@ namespace test namespace { -bool parse(string const& _source, ErrorList& errors) +bool parse(string const& _source, ErrorReporter& errorReporter) { try { auto scanner = make_shared<Scanner>(CharStream(_source)); - auto parserResult = assembly::Parser(errors, true).parse(scanner); + auto parserResult = assembly::Parser(errorReporter, true).parse(scanner); if (parserResult) { assembly::AsmAnalysisInfo analysisInfo; - return (assembly::AsmAnalyzer(analysisInfo, errors, true)).analyze(*parserResult); + return (assembly::AsmAnalyzer(analysisInfo, errorReporter, true)).analyze(*parserResult); } } catch (FatalError const&) @@ -67,7 +67,8 @@ bool parse(string const& _source, ErrorList& errors) boost::optional<Error> parseAndReturnFirstError(string const& _source, bool _allowWarnings = true) { ErrorList errors; - if (!parse(_source, errors)) + ErrorReporter errorReporter(errors); + if (!parse(_source, errorReporter)) { BOOST_REQUIRE_EQUAL(errors.size(), 1); return *errors.front(); |