mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename ExpressionBreaker to ExpressionSplitter.
This commit is contained in:
parent
62fb0e29c9
commit
f950973eb2
@ -19,7 +19,7 @@
|
||||
* declarations.
|
||||
*/
|
||||
|
||||
#include <libjulia/optimiser/ExpressionBreaker.h>
|
||||
#include <libjulia/optimiser/ExpressionSplitter.h>
|
||||
|
||||
#include <libjulia/optimiser/ASTWalker.h>
|
||||
|
||||
@ -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<Statement> 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;
|
@ -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)
|
||||
{ }
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <test/libjulia/Common.h>
|
||||
|
||||
#include <libjulia/optimiser/ExpressionBreaker.h>
|
||||
#include <libjulia/optimiser/ExpressionSplitter.h>
|
||||
#include <libjulia/optimiser/NameCollector.h>
|
||||
|
||||
#include <libsolidity/inlineasm/AsmPrinter.h>
|
||||
@ -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)
|
||||
{
|
Loading…
Reference in New Issue
Block a user