mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #3472 from ethereum/removeemptyblocks
Use removeEmptyBlocks helper in FunctionHoister
This commit is contained in:
commit
2095e7a32d
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libjulia/optimiser/FunctionHoister.h>
|
#include <libjulia/optimiser/FunctionHoister.h>
|
||||||
|
#include <libjulia/optimiser/Utilities.h>
|
||||||
|
|
||||||
#include <libsolidity/inlineasm/AsmData.h>
|
#include <libsolidity/inlineasm/AsmData.h>
|
||||||
|
|
||||||
@ -28,14 +29,11 @@
|
|||||||
|
|
||||||
#include <libdevcore/CommonData.h>
|
#include <libdevcore/CommonData.h>
|
||||||
|
|
||||||
#include <boost/range/algorithm_ext/erase.hpp>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::julia;
|
using namespace dev::julia;
|
||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
|
|
||||||
void FunctionHoister::operator()(Block& _block)
|
void FunctionHoister::operator()(Block& _block)
|
||||||
{
|
{
|
||||||
bool topLevel = m_isTopLevel;
|
bool topLevel = m_isTopLevel;
|
||||||
@ -49,11 +47,7 @@ void FunctionHoister::operator()(Block& _block)
|
|||||||
statement = Block{_block.location, {}};
|
statement = Block{_block.location, {}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto isEmptyBlock = [](Statement const& _st) -> bool {
|
removeEmptyBlocks(_block);
|
||||||
return _st.type() == typeid(Block) && boost::get<Block>(_st).statements.empty();
|
|
||||||
};
|
|
||||||
// Remove empty blocks
|
|
||||||
boost::range::remove_erase_if(_block.statements, isEmptyBlock);
|
|
||||||
if (topLevel)
|
if (topLevel)
|
||||||
_block.statements += std::move(m_functions);
|
_block.statements += std::move(m_functions);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user