diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-23 00:32:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-23 00:32:29 +0800 |
commit | ccb689701e6a602a44bf2941ca71c683f96907d1 (patch) | |
tree | d66e39ec76a38773170dbf4070d158d66db34878 | |
parent | 1be33872ba773a1bee0b42c1c4aed751a081ca53 (diff) | |
parent | f28d40ef0b58ef502ad39d7c953b50fc50430b5e (diff) | |
download | dexon-solidity-ccb689701e6a602a44bf2941ca71c683f96907d1.tar.gz dexon-solidity-ccb689701e6a602a44bf2941ca71c683f96907d1.tar.zst dexon-solidity-ccb689701e6a602a44bf2941ca71c683f96907d1.zip |
Merge pull request #2940 from ethereum/verboseErrors
More verbos error reports.
-rw-r--r-- | libdevcore/Whiskers.cpp | 8 | ||||
-rw-r--r-- | libsolidity/codegen/CompilerContext.cpp | 20 |
2 files changed, 25 insertions, 3 deletions
diff --git a/libdevcore/Whiskers.cpp b/libdevcore/Whiskers.cpp index b0a4c755..a6db35c8 100644 --- a/libdevcore/Whiskers.cpp +++ b/libdevcore/Whiskers.cpp @@ -90,7 +90,13 @@ string Whiskers::replace( string tagName(_match[1]); if (!tagName.empty()) { - assertThrow(_parameters.count(tagName), WhiskersError, "Value for tag " + tagName + " not provided."); + assertThrow( + _parameters.count(tagName), + WhiskersError, + "Value for tag " + tagName + " not provided.\n" + + "Template:\n" + + _template + ); return _parameters.at(tagName); } else diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 5a77162e..d87c7be5 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -26,6 +26,7 @@ #include <libsolidity/codegen/Compiler.h> #include <libsolidity/interface/Version.h> #include <libsolidity/interface/ErrorReporter.h> +#include <libsolidity/interface/SourceReferenceFormatter.h> #include <libsolidity/parsing/Scanner.h> #include <libsolidity/inlineasm/AsmParser.h> #include <libsolidity/inlineasm/AsmCodeGen.h> @@ -312,8 +313,23 @@ void CompilerContext::appendInlineAssembly( ErrorReporter errorReporter(errors); auto scanner = make_shared<Scanner>(CharStream(_assembly), "--CODEGEN--"); auto parserResult = assembly::Parser(errorReporter).parse(scanner); - solAssert(parserResult, "Failed to parse inline assembly block."); - solAssert(errorReporter.errors().empty(), "Failed to parse inline assembly block."); + if (!parserResult || !errorReporter.errors().empty()) + { + string message = + "Error parsing inline assembly block:\n" + "------------------ Input: -----------------\n" + + _assembly + "\n" + "------------------ Errors: ----------------\n"; + for (auto const& error: errorReporter.errors()) + message += SourceReferenceFormatter::formatExceptionInformation( + *error, + (error->type() == Error::Type::Warning) ? "Warning" : "Error", + [&](string const&) -> Scanner const& { return *scanner; } + ); + message += "-------------------------------------------\n"; + + solAssert(false, message); + } assembly::AsmAnalysisInfo analysisInfo; assembly::AsmAnalyzer analyzer(analysisInfo, errorReporter, false, identifierAccess.resolve); |