mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replaced boost::adaptors::transformed
This commit is contained in:
parent
98a8640928
commit
b2ca7916aa
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include <libsolutil/Algorithms.h>
|
#include <libsolutil/Algorithms.h>
|
||||||
|
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
#include <range/v3/view/transform.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace solidity::langutil;
|
using namespace solidity::langutil;
|
||||||
@ -344,7 +344,7 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable)
|
|||||||
{
|
{
|
||||||
errorString = "Data location must be " +
|
errorString = "Data location must be " +
|
||||||
util::joinHumanReadable(
|
util::joinHumanReadable(
|
||||||
allowedDataLocations | boost::adaptors::transformed(locationToString),
|
allowedDataLocations | ranges::views::transform(locationToString),
|
||||||
", ",
|
", ",
|
||||||
" or "
|
" or "
|
||||||
);
|
);
|
||||||
|
@ -42,11 +42,11 @@
|
|||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/range/adaptor/sliced.hpp>
|
#include <boost/range/adaptor/sliced.hpp>
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
|
||||||
#include <boost/range/algorithm/copy.hpp>
|
#include <boost/range/algorithm/copy.hpp>
|
||||||
|
|
||||||
#include <range/v3/view/enumerate.hpp>
|
#include <range/v3/view/enumerate.hpp>
|
||||||
#include <range/v3/view/reverse.hpp>
|
#include <range/v3/view/reverse.hpp>
|
||||||
|
#include <range/v3/view/transform.hpp>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
@ -227,7 +227,7 @@ string richIdentifier(Type const* _type)
|
|||||||
|
|
||||||
string identifierList(vector<Type const*> const& _list)
|
string identifierList(vector<Type const*> const& _list)
|
||||||
{
|
{
|
||||||
return identifierList(_list | boost::adaptors::transformed(richIdentifier));
|
return identifierList(_list | ranges::views::transform(richIdentifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
string identifierList(Type const* _type)
|
string identifierList(Type const* _type)
|
||||||
@ -2374,7 +2374,7 @@ string StructType::signatureInExternalFunction(bool _structsByName) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
TypePointers memberTypes = memoryMemberTypes();
|
TypePointers memberTypes = memoryMemberTypes();
|
||||||
auto memberTypeStrings = memberTypes | boost::adaptors::transformed([&](Type const* _t) -> string
|
auto memberTypeStrings = memberTypes | ranges::views::transform([&](Type const* _t) -> string
|
||||||
{
|
{
|
||||||
solAssert(_t, "Parameter should have external type.");
|
solAssert(_t, "Parameter should have external type.");
|
||||||
auto t = _t->interfaceType(_structsByName);
|
auto t = _t->interfaceType(_structsByName);
|
||||||
@ -3439,7 +3439,7 @@ string FunctionType::externalSignature() const
|
|||||||
|
|
||||||
solAssert(extParams.message().empty(), extParams.message());
|
solAssert(extParams.message().empty(), extParams.message());
|
||||||
|
|
||||||
auto typeStrings = extParams.get() | boost::adaptors::transformed([&](Type const* _t) -> string
|
auto typeStrings = extParams.get() | ranges::views::transform([&](Type const* _t) -> string
|
||||||
{
|
{
|
||||||
string typeName = _t->signatureInExternalFunction(inLibrary);
|
string typeName = _t->signatureInExternalFunction(inLibrary);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#include <libsolutil/FunctionSelector.h>
|
#include <libsolutil/FunctionSelector.h>
|
||||||
#include <libsolutil/Visitor.h>
|
#include <libsolutil/Visitor.h>
|
||||||
|
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
#include <range/v3/view/transform.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace solidity;
|
using namespace solidity;
|
||||||
@ -1037,7 +1037,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
templ("encode", abi.tupleEncoder(nonIndexedArgTypes, nonIndexedParamTypes));
|
templ("encode", abi.tupleEncoder(nonIndexedArgTypes, nonIndexedParamTypes));
|
||||||
templ("nonIndexedArgs", joinHumanReadablePrefixed(nonIndexedArgs));
|
templ("nonIndexedArgs", joinHumanReadablePrefixed(nonIndexedArgs));
|
||||||
templ("log", "log" + to_string(indexedArgs.size()));
|
templ("log", "log" + to_string(indexedArgs.size()));
|
||||||
templ("indexedArgs", joinHumanReadablePrefixed(indexedArgs | boost::adaptors::transformed([&](auto const& _arg) {
|
templ("indexedArgs", joinHumanReadablePrefixed(indexedArgs | ranges::views::transform([&](auto const& _arg) {
|
||||||
return _arg.commaSeparatedList();
|
return _arg.commaSeparatedList();
|
||||||
})));
|
})));
|
||||||
m_code << templ.render();
|
m_code << templ.render();
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include <libsolidity/codegen/ir/Common.h>
|
#include <libsolidity/codegen/ir/Common.h>
|
||||||
#include <libsolidity/codegen/ir/IRVariable.h>
|
#include <libsolidity/codegen/ir/IRVariable.h>
|
||||||
#include <libsolidity/ast/AST.h>
|
#include <libsolidity/ast/AST.h>
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
|
||||||
#include <libsolutil/StringUtils.h>
|
#include <libsolutil/StringUtils.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
|
||||||
|
#include <range/v3/view/transform.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -83,7 +84,7 @@ string AsmPrinter::operator()(VariableDeclaration const& _variableDeclaration) c
|
|||||||
{
|
{
|
||||||
string out = "let ";
|
string out = "let ";
|
||||||
out += boost::algorithm::join(
|
out += boost::algorithm::join(
|
||||||
_variableDeclaration.variables | boost::adaptors::transformed(
|
_variableDeclaration.variables | ranges::views::transform(
|
||||||
[this](TypedName argument) { return formatTypedName(argument); }
|
[this](TypedName argument) { return formatTypedName(argument); }
|
||||||
),
|
),
|
||||||
", "
|
", "
|
||||||
@ -101,7 +102,7 @@ string AsmPrinter::operator()(FunctionDefinition const& _functionDefinition) con
|
|||||||
yulAssert(!_functionDefinition.name.empty(), "Invalid function name.");
|
yulAssert(!_functionDefinition.name.empty(), "Invalid function name.");
|
||||||
string out = "function " + _functionDefinition.name.str() + "(";
|
string out = "function " + _functionDefinition.name.str() + "(";
|
||||||
out += boost::algorithm::join(
|
out += boost::algorithm::join(
|
||||||
_functionDefinition.parameters | boost::adaptors::transformed(
|
_functionDefinition.parameters | ranges::views::transform(
|
||||||
[this](TypedName argument) { return formatTypedName(argument); }
|
[this](TypedName argument) { return formatTypedName(argument); }
|
||||||
),
|
),
|
||||||
", "
|
", "
|
||||||
@ -111,7 +112,7 @@ string AsmPrinter::operator()(FunctionDefinition const& _functionDefinition) con
|
|||||||
{
|
{
|
||||||
out += " -> ";
|
out += " -> ";
|
||||||
out += boost::algorithm::join(
|
out += boost::algorithm::join(
|
||||||
_functionDefinition.returnVariables | boost::adaptors::transformed(
|
_functionDefinition.returnVariables | ranges::views::transform(
|
||||||
[this](TypedName argument) { return formatTypedName(argument); }
|
[this](TypedName argument) { return formatTypedName(argument); }
|
||||||
),
|
),
|
||||||
", "
|
", "
|
||||||
@ -126,7 +127,7 @@ string AsmPrinter::operator()(FunctionCall const& _functionCall) const
|
|||||||
return
|
return
|
||||||
(*this)(_functionCall.functionName) + "(" +
|
(*this)(_functionCall.functionName) + "(" +
|
||||||
boost::algorithm::join(
|
boost::algorithm::join(
|
||||||
_functionCall.arguments | boost::adaptors::transformed([&](auto&& _node) { return std::visit(*this, _node); }),
|
_functionCall.arguments | ranges::views::transform([&](auto&& _node) { return std::visit(*this, _node); }),
|
||||||
", " ) +
|
", " ) +
|
||||||
")";
|
")";
|
||||||
}
|
}
|
||||||
@ -194,7 +195,7 @@ string AsmPrinter::operator()(Block const& _block) const
|
|||||||
if (_block.statements.empty())
|
if (_block.statements.empty())
|
||||||
return "{ }";
|
return "{ }";
|
||||||
string body = boost::algorithm::join(
|
string body = boost::algorithm::join(
|
||||||
_block.statements | boost::adaptors::transformed([&](auto&& _node) { return std::visit(*this, _node); }),
|
_block.statements | ranges::views::transform([&](auto&& _node) { return std::visit(*this, _node); }),
|
||||||
"\n"
|
"\n"
|
||||||
);
|
);
|
||||||
if (body.size() < 30 && body.find('\n') == string::npos)
|
if (body.size() < 30 && body.find('\n') == string::npos)
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#include <libsolutil/Visitor.h>
|
#include <libsolutil/Visitor.h>
|
||||||
#include <libsolutil/LEB128.h>
|
#include <libsolutil/LEB128.h>
|
||||||
|
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
|
||||||
|
|
||||||
#include <range/v3/view/map.hpp>
|
#include <range/v3/view/map.hpp>
|
||||||
#include <range/v3/view/reverse.hpp>
|
#include <range/v3/view/reverse.hpp>
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
|
||||||
|
#include <range/v3/view/transform.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace solidity;
|
using namespace solidity;
|
||||||
@ -67,7 +68,7 @@ string TextTransform::run(wasm::Module const& _module)
|
|||||||
{
|
{
|
||||||
ret += " (import \"" + imp.module + "\" \"" + imp.externalName + "\" (func $" + imp.internalName;
|
ret += " (import \"" + imp.module + "\" \"" + imp.externalName + "\" (func $" + imp.internalName;
|
||||||
if (!imp.paramTypes.empty())
|
if (!imp.paramTypes.empty())
|
||||||
ret += " (param" + joinHumanReadablePrefixed(imp.paramTypes | boost::adaptors::transformed(encodeType), " ", " ") + ")";
|
ret += " (param" + joinHumanReadablePrefixed(imp.paramTypes | ranges::views::transform(encodeType), " ", " ") + ")";
|
||||||
if (imp.returnType)
|
if (imp.returnType)
|
||||||
ret += " (result " + encodeType(*imp.returnType) + ")";
|
ret += " (result " + encodeType(*imp.returnType) + ")";
|
||||||
ret += "))\n";
|
ret += "))\n";
|
||||||
|
@ -59,10 +59,11 @@
|
|||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
|
||||||
#include <boost/range/adaptor/filtered.hpp>
|
#include <boost/range/adaptor/filtered.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
#include <range/v3/view/transform.hpp>
|
||||||
|
|
||||||
#ifdef _WIN32 // windows
|
#ifdef _WIN32 // windows
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#define isatty _isatty
|
#define isatty _isatty
|
||||||
@ -2090,7 +2091,7 @@ size_t CommandLineInterface::countEnabledOptions(vector<string> const& _optionNa
|
|||||||
string CommandLineInterface::joinOptionNames(vector<string> const& _optionNames, string _separator)
|
string CommandLineInterface::joinOptionNames(vector<string> const& _optionNames, string _separator)
|
||||||
{
|
{
|
||||||
return boost::algorithm::join(
|
return boost::algorithm::join(
|
||||||
_optionNames | boost::adaptors::transformed([](string const& _option){ return "--" + _option; }),
|
_optionNames | ranges::views::transform([](string const& _option){ return "--" + _option; }),
|
||||||
_separator
|
_separator
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,10 @@
|
|||||||
#include <libsolutil/Keccak256.h>
|
#include <libsolutil/Keccak256.h>
|
||||||
#include <libsolutil/ErrorCodes.h>
|
#include <libsolutil/ErrorCodes.h>
|
||||||
|
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
#include <range/v3/view/transform.hpp>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -3143,11 +3144,11 @@ BOOST_AUTO_TEST_CASE(calldata_array_dynamic_three_dimensional)
|
|||||||
bytes encoding = encodeArray(
|
bytes encoding = encodeArray(
|
||||||
outerDynamicallySized,
|
outerDynamicallySized,
|
||||||
middleDynamicallySized || innerDynamicallySized,
|
middleDynamicallySized || innerDynamicallySized,
|
||||||
data | boost::adaptors::transformed([&](auto const& _middleData) {
|
data | ranges::views::transform([&](auto const& _middleData) {
|
||||||
return encodeArray(
|
return encodeArray(
|
||||||
middleDynamicallySized,
|
middleDynamicallySized,
|
||||||
innerDynamicallySized,
|
innerDynamicallySized,
|
||||||
_middleData | boost::adaptors::transformed([&](auto const& _values) {
|
_middleData | ranges::views::transform([&](auto const& _values) {
|
||||||
return encodeArray(innerDynamicallySized, false, _values);
|
return encodeArray(innerDynamicallySized, false, _values);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user