aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-06 21:01:39 +0800
committerGitHub <noreply@github.com>2018-12-06 21:01:39 +0800
commit0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d (patch)
treea247b6ea5b9b305e60d9e4d403e805335415ba6f /test/libyul
parent1643d63e3af1b0e3aabac2f2ded3619505d0fa8c (diff)
parent073b03d90c8f0648ba135f0b30d8e72fd871478f (diff)
downloaddexon-solidity-0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d.tar.gz
dexon-solidity-0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d.tar.zst
dexon-solidity-0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d.zip
Merge pull request #5554 from ethereum/cp-SourceReferenceFormatter-refactor
[2/3] Refactor SourceReferenceFormatter (split-out data extraction & make use of new SourceLocation knowledge)
Diffstat (limited to 'test/libyul')
-rw-r--r--test/libyul/Common.cpp6
-rw-r--r--test/libyul/Common.h3
-rw-r--r--test/libyul/YulOptimizerTest.cpp8
-rw-r--r--test/libyul/YulOptimizerTest.h2
4 files changed, 9 insertions, 10 deletions
diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp
index e2462eb7..0f2529de 100644
--- a/test/libyul/Common.cpp
+++ b/test/libyul/Common.cpp
@@ -40,9 +40,9 @@ using namespace langutil;
using namespace yul;
using namespace dev::solidity;
-void yul::test::printErrors(ErrorList const& _errors, Scanner const& _scanner)
+void yul::test::printErrors(ErrorList const& _errors)
{
- SourceReferenceFormatter formatter(cout, [&](std::string const&) -> Scanner const& { return _scanner; });
+ SourceReferenceFormatter formatter(cout);
for (auto const& error: _errors)
formatter.printExceptionInformation(
@@ -76,7 +76,7 @@ pair<shared_ptr<Block>, shared_ptr<yul::AsmAnalysisInfo>> yul::test::parse(strin
return make_pair(parserResult, analysisInfo);
}
}
- printErrors(errors, *scanner);
+ printErrors(errors);
BOOST_FAIL("Invalid source.");
// Unreachable.
diff --git a/test/libyul/Common.h b/test/libyul/Common.h
index a1c64ca5..01fc416a 100644
--- a/test/libyul/Common.h
+++ b/test/libyul/Common.h
@@ -29,7 +29,6 @@
namespace langutil
{
-class Scanner;
class Error;
using ErrorList = std::vector<std::shared_ptr<Error const>>;
}
@@ -44,7 +43,7 @@ namespace yul
namespace test
{
-void printErrors(langutil::ErrorList const& _errors, langutil::Scanner const& _scanner);
+void printErrors(langutil::ErrorList const& _errors);
std::pair<std::shared_ptr<Block>, std::shared_ptr<AsmAnalysisInfo>>
parse(std::string const& _source, bool _yul = true);
Block disambiguate(std::string const& _source, bool _yul = true);
diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp
index d1d22fd0..96b9d263 100644
--- a/test/libyul/YulOptimizerTest.cpp
+++ b/test/libyul/YulOptimizerTest.cpp
@@ -264,7 +264,7 @@ bool YulOptimizerTest::parse(ostream& _stream, string const& _linePrefix, bool c
if (!m_ast || !errorReporter.errors().empty())
{
FormattedScope(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error parsing source." << endl;
- printErrors(_stream, errorReporter.errors(), *scanner);
+ printErrors(_stream, errorReporter.errors());
return false;
}
m_analysisInfo = make_shared<yul::AsmAnalysisInfo>();
@@ -278,7 +278,7 @@ bool YulOptimizerTest::parse(ostream& _stream, string const& _linePrefix, bool c
if (!analyzer.analyze(*m_ast) || !errorReporter.errors().empty())
{
FormattedScope(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error analyzing source." << endl;
- printErrors(_stream, errorReporter.errors(), *scanner);
+ printErrors(_stream, errorReporter.errors());
return false;
}
return true;
@@ -290,9 +290,9 @@ void YulOptimizerTest::disambiguate()
m_analysisInfo.reset();
}
-void YulOptimizerTest::printErrors(ostream& _stream, ErrorList const& _errors, Scanner const& _scanner)
+void YulOptimizerTest::printErrors(ostream& _stream, ErrorList const& _errors)
{
- SourceReferenceFormatter formatter(_stream, [&](string const&) -> Scanner const& { return _scanner; });
+ SourceReferenceFormatter formatter(_stream);
for (auto const& error: _errors)
formatter.printExceptionInformation(
diff --git a/test/libyul/YulOptimizerTest.h b/test/libyul/YulOptimizerTest.h
index 90026e24..5648e995 100644
--- a/test/libyul/YulOptimizerTest.h
+++ b/test/libyul/YulOptimizerTest.h
@@ -57,7 +57,7 @@ private:
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
void disambiguate();
- static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors, langutil::Scanner const& _scanner);
+ static void printErrors(std::ostream& _stream, langutil::ErrorList const& _errors);
std::string m_source;
bool m_yul = false;