From 89b60ffbd4c2dde26fa5e9f1d750729b5c89373e Mon Sep 17 00:00:00 2001 From: Rhett Aultman Date: Thu, 11 May 2017 06:26:35 -0700 Subject: 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 --- solc/jsonCompiler.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'solc') diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp index 7f99324e..1505a43d 100644 --- a/solc/jsonCompiler.cpp +++ b/solc/jsonCompiler.cpp @@ -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", -- cgit v1.2.3