Add shortcuts for formatting error information

This commit is contained in:
mingchuan
2019-04-10 18:44:45 +08:00
parent ef3a18999c
commit f1374066af
13 changed files with 34 additions and 55 deletions
+1 -4
View File
@@ -396,10 +396,7 @@ void CompilerContext::appendInlineAssembly(
_assembly + "\n"
"------------------ Errors: ----------------\n";
for (auto const& error: errorReporter.errors())
message += SourceReferenceFormatter::formatExceptionInformation(
*error,
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
);
message += SourceReferenceFormatter::formatErrorInformation(*error);
message += "-------------------------------------------\n";
solAssert(false, message);
+1 -4
View File
@@ -50,10 +50,7 @@ pair<string, string> IRGenerator::run(ContractDefinition const& _contract)
{
string errorMessage;
for (auto const& error: asmStack.errors())
errorMessage += langutil::SourceReferenceFormatter::formatExceptionInformation(
*error,
(error->type() == langutil::Error::Type::Warning) ? "Warning" : "Error"
);
errorMessage += langutil::SourceReferenceFormatter::formatErrorInformation(*error);
solAssert(false, "Invalid IR generated:\n" + errorMessage + "\n" + ir);
}
asmStack.optimize();