mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
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
This commit is contained in:
@@ -218,12 +218,13 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
|
||||
{
|
||||
// Do not taint the internal error list
|
||||
ErrorList formalErrors;
|
||||
if (compiler.prepareFormalAnalysis(&formalErrors))
|
||||
ErrorReporter errorReporter(formalErrors);
|
||||
if (compiler.prepareFormalAnalysis(&errorReporter))
|
||||
output["formal"]["why3"] = compiler.formalTranslation();
|
||||
if (!formalErrors.empty())
|
||||
if (!errorReporter.errors().empty())
|
||||
{
|
||||
Json::Value errors(Json::arrayValue);
|
||||
for (auto const& error: formalErrors)
|
||||
for (auto const& error: errorReporter.errors())
|
||||
errors.append(SourceReferenceFormatter::formatExceptionInformation(
|
||||
*error,
|
||||
(error->type() == Error::Type::Warning) ? "Warning" : "Error",
|
||||
|
||||
Reference in New Issue
Block a user