mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5554 from ethereum/cp-SourceReferenceFormatter-refactor
[2/3] Refactor SourceReferenceFormatter (split-out data extraction & make use of new SourceLocation knowledge)
This commit is contained in:
@@ -127,8 +127,7 @@ string AnalysisFramework::formatError(Error const& _error) const
|
||||
{
|
||||
return SourceReferenceFormatter::formatExceptionInformation(
|
||||
_error,
|
||||
(_error.type() == Error::Type::Warning) ? "Warning" : "Error",
|
||||
[&](std::string const& _sourceName) -> Scanner const& { return m_compiler.scanner(_sourceName); }
|
||||
(_error.type() == Error::Type::Warning) ? "Warning" : "Error"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +138,7 @@ BOOST_AUTO_TEST_CASE(non_overlapping_filtered_costs)
|
||||
if (first->first->location().intersects(second->first->location()))
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(false, "Source locations should not overlap!");
|
||||
auto scannerFromSource = [&](string const& _sourceName) -> Scanner const& { return m_compiler.scanner(_sourceName); };
|
||||
SourceReferenceFormatter formatter(cout, scannerFromSource);
|
||||
SourceReferenceFormatter formatter(cout);
|
||||
|
||||
formatter.printSourceLocation(&first->first->location());
|
||||
formatter.printSourceLocation(&second->first->location());
|
||||
|
||||
@@ -72,8 +72,7 @@ public:
|
||||
m_compiler.setOptimiserSettings(m_optimize, m_optimizeRuns);
|
||||
if (!m_compiler.compile())
|
||||
{
|
||||
auto scannerFromSourceName = [&](std::string const& _sourceName) -> langutil::Scanner const& { return m_compiler.scanner(_sourceName); };
|
||||
langutil::SourceReferenceFormatter formatter(std::cerr, scannerFromSourceName);
|
||||
langutil::SourceReferenceFormatter formatter(std::cerr);
|
||||
|
||||
for (auto const& error: m_compiler.errors())
|
||||
formatter.printExceptionInformation(
|
||||
|
||||
Reference in New Issue
Block a user