mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6484 from sifmelcara/create-SourceReferenceFormatter-shortcut
Add a shortcut for formatting error information
This commit is contained in:
@@ -125,10 +125,7 @@ string AnalysisFramework::formatErrors() const
|
||||
|
||||
string AnalysisFramework::formatError(Error const& _error) const
|
||||
{
|
||||
return SourceReferenceFormatter::formatExceptionInformation(
|
||||
_error,
|
||||
(_error.type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
return SourceReferenceFormatter::formatErrorInformation(_error);
|
||||
}
|
||||
|
||||
ContractDefinition const* AnalysisFramework::retrieveContractByName(SourceUnit const& _source, string const& _name)
|
||||
|
||||
@@ -83,10 +83,7 @@ public:
|
||||
langutil::SourceReferenceFormatter formatter(std::cerr);
|
||||
|
||||
for (auto const& error: m_compiler.errors())
|
||||
formatter.printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == langutil::Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
formatter.printErrorInformation(*error);
|
||||
BOOST_ERROR("Compiling contract failed");
|
||||
}
|
||||
eth::LinkerObject obj;
|
||||
@@ -104,10 +101,7 @@ public:
|
||||
langutil::SourceReferenceFormatter formatter(std::cerr);
|
||||
|
||||
for (auto const& error: m_compiler.errors())
|
||||
formatter.printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == langutil::Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
formatter.printErrorInformation(*error);
|
||||
BOOST_ERROR("Assembly contract failed. IR: " + m_compiler.yulIROptimized({}));
|
||||
}
|
||||
asmStack.optimize();
|
||||
|
||||
@@ -54,10 +54,7 @@ void yul::test::printErrors(ErrorList const& _errors)
|
||||
SourceReferenceFormatter formatter(cout);
|
||||
|
||||
for (auto const& error: _errors)
|
||||
formatter.printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
formatter.printErrorInformation(*error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -130,8 +130,5 @@ void ObjectCompilerTest::printErrors(ostream& _stream, ErrorList const& _errors)
|
||||
SourceReferenceFormatter formatter(_stream);
|
||||
|
||||
for (auto const& error: _errors)
|
||||
formatter.printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
formatter.printErrorInformation(*error);
|
||||
}
|
||||
|
||||
@@ -159,8 +159,5 @@ void YulInterpreterTest::printErrors(ostream& _stream, ErrorList const& _errors)
|
||||
SourceReferenceFormatter formatter(_stream);
|
||||
|
||||
for (auto const& error: _errors)
|
||||
formatter.printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
formatter.printErrorInformation(*error);
|
||||
}
|
||||
|
||||
@@ -354,8 +354,5 @@ void YulOptimizerTest::printErrors(ostream& _stream, ErrorList const& _errors)
|
||||
SourceReferenceFormatter formatter(_stream);
|
||||
|
||||
for (auto const& error: _errors)
|
||||
formatter.printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
formatter.printErrorInformation(*error);
|
||||
}
|
||||
|
||||
@@ -80,10 +80,7 @@ public:
|
||||
SourceReferenceFormatter formatter(cout);
|
||||
|
||||
for (auto const& error: m_errors)
|
||||
formatter.printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
formatter.printErrorInformation(*error);
|
||||
}
|
||||
|
||||
bool parse(string const& _input)
|
||||
|
||||
@@ -55,10 +55,7 @@ namespace
|
||||
void printErrors(ErrorList const& _errors)
|
||||
{
|
||||
for (auto const& error: _errors)
|
||||
SourceReferenceFormatter(cout).printExceptionInformation(
|
||||
*error,
|
||||
(error->type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
SourceReferenceFormatter(cout).printErrorInformation(*error);
|
||||
}
|
||||
|
||||
pair<shared_ptr<Block>, shared_ptr<AsmAnalysisInfo>> parse(string const& _source)
|
||||
|
||||
Reference in New Issue
Block a user