aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/Common.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2019-01-08 00:23:05 +0800
committerGitHub <noreply@github.com>2019-01-08 00:23:05 +0800
commit9f5d34af7de481c5b8ce89057a6df2a3283d14b0 (patch)
tree273c2c234e637a8c33ebbe041d8f2c4f8ef99c51 /test/libyul/Common.cpp
parent165a6891212bd440a65da4084a823dccbf83a433 (diff)
parent9222eff08fad8e6a0ea7df8b299880f90c68c8b3 (diff)
downloaddexon-solidity-9f5d34af7de481c5b8ce89057a6df2a3283d14b0.tar.gz
dexon-solidity-9f5d34af7de481c5b8ce89057a6df2a3283d14b0.tar.zst
dexon-solidity-9f5d34af7de481c5b8ce89057a6df2a3283d14b0.zip
Merge pull request #5752 from ethereum/addDialect
[Yul] Refactor: Make the dialect available everywhere.
Diffstat (limited to 'test/libyul/Common.cpp')
-rw-r--r--test/libyul/Common.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp
index a337fa8d..ea4d0208 100644
--- a/test/libyul/Common.cpp
+++ b/test/libyul/Common.cpp
@@ -41,6 +41,14 @@ using namespace langutil;
using namespace yul;
using namespace dev::solidity;
+namespace
+{
+shared_ptr<Dialect> defaultDialect(bool _yul)
+{
+ return _yul ? yul::Dialect::yul() : yul::EVMDialect::strictAssemblyForEVM();
+}
+}
+
void yul::test::printErrors(ErrorList const& _errors)
{
SourceReferenceFormatter formatter(cout);
@@ -55,7 +63,7 @@ void yul::test::printErrors(ErrorList const& _errors)
pair<shared_ptr<Block>, shared_ptr<yul::AsmAnalysisInfo>> yul::test::parse(string const& _source, bool _yul)
{
- shared_ptr<Dialect> dialect = _yul ? yul::Dialect::yul() : yul::EVMDialect::strictAssemblyForEVM();
+ shared_ptr<Dialect> dialect = defaultDialect(_yul);
ErrorList errors;
ErrorReporter errorReporter(errors);
auto scanner = make_shared<Scanner>(CharStream(_source, ""));
@@ -87,7 +95,7 @@ pair<shared_ptr<Block>, shared_ptr<yul::AsmAnalysisInfo>> yul::test::parse(strin
yul::Block yul::test::disambiguate(string const& _source, bool _yul)
{
auto result = parse(_source, _yul);
- return boost::get<Block>(Disambiguator(*result.second, {})(*result.first));
+ return boost::get<Block>(Disambiguator(*defaultDialect(_yul), *result.second, {})(*result.first));
}
string yul::test::format(string const& _source, bool _yul)