mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replaced keys, values and reverse with ranges
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
#include <libsolutil/Whiskers.h>
|
||||
#include <libsolutil/FunctionSelector.h>
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <range/v3/view/reverse.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -152,9 +152,7 @@ void ContractCompiler::appendInitAndConstructorCode(ContractDefinition const& _c
|
||||
m_baseArguments = &_contract.annotation().baseConstructorArguments;
|
||||
|
||||
// Initialization of state variables in base-to-derived order.
|
||||
for (ContractDefinition const* contract: boost::adaptors::reverse(
|
||||
_contract.annotation().linearizedBaseContracts
|
||||
))
|
||||
for (ContractDefinition const* contract: _contract.annotation().linearizedBaseContracts | ranges::views::reverse)
|
||||
initializeStateVariables(*contract);
|
||||
|
||||
if (FunctionDefinition const* constructor = _contract.constructor())
|
||||
@@ -200,10 +198,10 @@ size_t ContractCompiler::packIntoContractCreator(ContractDefinition const& _cont
|
||||
m_context.pushSubroutineOffset(m_context.runtimeSub());
|
||||
m_context << u256(0) << Instruction::CODECOPY;
|
||||
// Assign immutable values from stack in reversed order.
|
||||
for (auto const& immutable: immutables | boost::adaptors::reversed)
|
||||
for (auto const& immutable: immutables | ranges::views::reverse)
|
||||
{
|
||||
auto slotNames = m_context.immutableVariableSlotNames(*immutable);
|
||||
for (auto&& slotName: slotNames | boost::adaptors::reversed)
|
||||
for (auto&& slotName: slotNames | ranges::views::reverse)
|
||||
{
|
||||
m_context << u256(0);
|
||||
m_context.appendImmutableAssignment(slotName);
|
||||
@@ -1096,7 +1094,7 @@ bool ContractCompiler::visit(TryCatchClause const& _clause)
|
||||
unsigned varSize = 0;
|
||||
|
||||
if (_clause.parameters())
|
||||
for (ASTPointer<VariableDeclaration> const& varDecl: _clause.parameters()->parameters() | boost::adaptors::reversed)
|
||||
for (ASTPointer<VariableDeclaration> const& varDecl: _clause.parameters()->parameters() | ranges::views::reverse)
|
||||
{
|
||||
solAssert(varDecl, "");
|
||||
varSize += varDecl->annotation().type->sizeOnStack();
|
||||
@@ -1258,7 +1256,7 @@ bool ContractCompiler::visit(Return const& _return)
|
||||
expectedType = types.front();
|
||||
compileExpression(*expression, expectedType);
|
||||
|
||||
for (auto const& retVariable: boost::adaptors::reverse(returnParameters))
|
||||
for (auto const& retVariable: returnParameters | ranges::views::reverse)
|
||||
CompilerUtils(m_context).moveToStackVariable(*retVariable);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user