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:
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <liblangutil/Exceptions.h>
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <range/v3/view/reverse.hpp>
|
||||
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
@@ -278,7 +278,7 @@ void CodeTransform::operator()(FunctionCall const& _call)
|
||||
}), "Function name not found.");
|
||||
yulAssert(function, "");
|
||||
yulAssert(function->arguments.size() == _call.arguments.size(), "");
|
||||
for (auto const& arg: _call.arguments | boost::adaptors::reversed)
|
||||
for (auto const& arg: _call.arguments | ranges::views::reverse)
|
||||
visitExpression(arg);
|
||||
m_assembly.setSourceLocation(_call.location);
|
||||
m_assembly.appendJumpTo(
|
||||
@@ -397,7 +397,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
|
||||
yulAssert(m_info.scopes.at(&_function.body), "");
|
||||
Scope* varScope = m_info.scopes.at(m_info.virtualBlocks.at(&_function).get()).get();
|
||||
yulAssert(varScope, "");
|
||||
for (auto const& v: _function.parameters | boost::adaptors::reversed)
|
||||
for (auto const& v: _function.parameters | ranges::views::reverse)
|
||||
{
|
||||
auto& var = std::get<Scope::Variable>(varScope->identifiers.at(v.name));
|
||||
m_context->variableStackHeights[&var] = height++;
|
||||
@@ -664,7 +664,7 @@ void CodeTransform::finalizeBlock(Block const& _block, int blockStartStackHeight
|
||||
void CodeTransform::generateMultiAssignment(vector<Identifier> const& _variableNames)
|
||||
{
|
||||
yulAssert(m_scope, "");
|
||||
for (auto const& variableName: _variableNames | boost::adaptors::reversed)
|
||||
for (auto const& variableName: _variableNames | ranges::views::reverse)
|
||||
generateAssignment(variableName);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include <liblangutil/Exceptions.h>
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <range/v3/view/reverse.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace solidity;
|
||||
@@ -49,7 +49,7 @@ void visitArguments(
|
||||
function<void(Expression const&)> _visitExpression
|
||||
)
|
||||
{
|
||||
for (auto const& arg: _call.arguments | boost::adaptors::reversed)
|
||||
for (auto const& arg: _call.arguments | ranges::views::reverse)
|
||||
_visitExpression(arg);
|
||||
|
||||
_assembly.setSourceLocation(_call.location);
|
||||
|
||||
@@ -26,10 +26,11 @@
|
||||
#include <libsolutil/Visitor.h>
|
||||
#include <libsolutil/LEB128.h>
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
|
||||
#include <range/v3/view/map.hpp>
|
||||
#include <range/v3/view/reverse.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace solidity;
|
||||
using namespace solidity::yul;
|
||||
@@ -580,7 +581,7 @@ map<string, size_t> BinaryTransform::enumerateFunctionTypes(map<Type, vector<str
|
||||
{
|
||||
map<string, size_t> functionTypes;
|
||||
size_t typeID = 0;
|
||||
for (vector<string> const& funNames: _typeToFunctionMap | boost::adaptors::map_values)
|
||||
for (vector<string> const& funNames: _typeToFunctionMap | ranges::views::values)
|
||||
{
|
||||
for (string const& name: funNames)
|
||||
functionTypes[name] = typeID;
|
||||
@@ -594,7 +595,7 @@ bytes BinaryTransform::typeSection(map<BinaryTransform::Type, vector<string>> co
|
||||
{
|
||||
bytes result;
|
||||
size_t index = 0;
|
||||
for (Type const& type: _typeToFunctionMap | boost::adaptors::map_keys)
|
||||
for (Type const& type: _typeToFunctionMap | ranges::views::keys)
|
||||
{
|
||||
result += toBytes(ValueType::Function);
|
||||
result += lebEncode(type.first.size()) + type.first;
|
||||
@@ -695,7 +696,7 @@ bytes BinaryTransform::visit(vector<Expression> const& _expressions)
|
||||
bytes BinaryTransform::visitReversed(vector<Expression> const& _expressions)
|
||||
{
|
||||
bytes result;
|
||||
for (auto const& expr: _expressions | boost::adaptors::reversed)
|
||||
for (auto const& expr: _expressions | ranges::views::reverse)
|
||||
result += std::visit(*this, expr);
|
||||
return result;
|
||||
}
|
||||
@@ -704,7 +705,7 @@ bytes BinaryTransform::encodeLabelIdx(string const& _label) const
|
||||
{
|
||||
yulAssert(!_label.empty(), "Empty label.");
|
||||
size_t depth = 0;
|
||||
for (string const& label: m_labels | boost::adaptors::reversed)
|
||||
for (string const& label: m_labels | ranges::views::reverse)
|
||||
if (label == _label)
|
||||
return lebEncode(depth);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user