diff --git a/libjulia/optimiser/ExpressionBreaker.cpp b/libjulia/optimiser/ExpressionSplitter.cpp similarity index 84% rename from libjulia/optimiser/ExpressionBreaker.cpp rename to libjulia/optimiser/ExpressionSplitter.cpp index 2273fa982..4448a15ba 100644 --- a/libjulia/optimiser/ExpressionBreaker.cpp +++ b/libjulia/optimiser/ExpressionSplitter.cpp @@ -19,7 +19,7 @@ * declarations. */ -#include +#include #include @@ -34,25 +34,25 @@ using namespace dev; using namespace dev::julia; using namespace dev::solidity; -void ExpressionBreaker::operator()(FunctionalInstruction& _instruction) +void ExpressionSplitter::operator()(FunctionalInstruction& _instruction) { for (auto& arg: _instruction.arguments | boost::adaptors::reversed) outlineExpression(arg); } -void ExpressionBreaker::operator()(FunctionCall& _funCall) +void ExpressionSplitter::operator()(FunctionCall& _funCall) { for (auto& arg: _funCall.arguments | boost::adaptors::reversed) outlineExpression(arg); } -void ExpressionBreaker::operator()(If& _if) +void ExpressionSplitter::operator()(If& _if) { outlineExpression(*_if.condition); (*this)(_if.body); } -void ExpressionBreaker::operator()(Switch& _switch) +void ExpressionSplitter::operator()(Switch& _switch) { outlineExpression(*_switch.expression); for (auto& _case: _switch.cases) @@ -60,7 +60,7 @@ void ExpressionBreaker::operator()(Switch& _switch) (*this)(_case.body); } -void ExpressionBreaker::operator()(ForLoop& _loop) +void ExpressionSplitter::operator()(ForLoop& _loop) { (*this)(_loop.pre); // Do not visit the condition because we cannot break expressions there. @@ -68,7 +68,7 @@ void ExpressionBreaker::operator()(ForLoop& _loop) (*this)(_loop.body); } -void ExpressionBreaker::operator()(Block& _block) +void ExpressionSplitter::operator()(Block& _block) { vector saved; swap(saved, m_statementsToPrefix); @@ -87,7 +87,7 @@ void ExpressionBreaker::operator()(Block& _block) swap(saved, m_statementsToPrefix); } -void ExpressionBreaker::outlineExpression(Expression& _expr) +void ExpressionSplitter::outlineExpression(Expression& _expr) { if (_expr.type() != typeid(FunctionalInstruction) && _expr.type() != typeid(FunctionCall)) return; diff --git a/libjulia/optimiser/ExpressionBreaker.h b/libjulia/optimiser/ExpressionSplitter.h similarity index 95% rename from libjulia/optimiser/ExpressionBreaker.h rename to libjulia/optimiser/ExpressionSplitter.h index 28cfdbc97..324d2b13f 100644 --- a/libjulia/optimiser/ExpressionBreaker.h +++ b/libjulia/optimiser/ExpressionSplitter.h @@ -56,10 +56,10 @@ class NameCollector; * function calls can only appear in the right-hand side of a variable declaration, * assignments or expression statements and all arguments have to be constants or variables. */ -class ExpressionBreaker: public ASTModifier +class ExpressionSplitter: public ASTModifier { public: - explicit ExpressionBreaker(NameDispenser& _nameDispenser): + explicit ExpressionSplitter(NameDispenser& _nameDispenser): m_nameDispenser(_nameDispenser) { } diff --git a/test/libjulia/ExpressionBreaker.cpp b/test/libjulia/ExpressionSplitter.cpp similarity index 95% rename from test/libjulia/ExpressionBreaker.cpp rename to test/libjulia/ExpressionSplitter.cpp index de8d22517..9707fa867 100644 --- a/test/libjulia/ExpressionBreaker.cpp +++ b/test/libjulia/ExpressionSplitter.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include @@ -43,12 +43,12 @@ do\ auto result = parse(_original, false);\ NameDispenser nameDispenser;\ nameDispenser.m_usedNames = NameCollector(*result.first).names();\ - ExpressionBreaker{nameDispenser}(*result.first);\ + ExpressionSplitter{nameDispenser}(*result.first);\ BOOST_CHECK_EQUAL(assembly::AsmPrinter{}(*result.first), format(_expectation, false));\ }\ while(false) -BOOST_AUTO_TEST_SUITE(YulExpressionBreaker) +BOOST_AUTO_TEST_SUITE(YulExpressionSplitter) BOOST_AUTO_TEST_CASE(smoke_test) {