Remove more imports of ranges namespace.

This commit is contained in:
Daniel Kirchner
2021-05-07 15:42:17 +02:00
parent c69add1682
commit 6104ac1cdf
5 changed files with 29 additions and 29 deletions
+3 -4
View File
@@ -25,7 +25,6 @@
#include <range/v3/view/transform.hpp>
using namespace std;
using namespace ranges;
using namespace solidity::frontend;
using namespace solidity::util;
@@ -35,7 +34,7 @@ CallGraph FunctionCallGraphBuilder::buildCreationGraph(ContractDefinition const&
solAssert(builder.m_currentNode == CallGraph::Node(CallGraph::SpecialNode::Entry), "");
// Create graph for constructor, state vars, etc
for (ContractDefinition const* base: _contract.annotation().linearizedBaseContracts | views::reverse)
for (ContractDefinition const* base: _contract.annotation().linearizedBaseContracts | ranges::views::reverse)
{
// The constructor and functions called in state variable initial assignments should have
// an edge from Entry
@@ -76,7 +75,7 @@ CallGraph FunctionCallGraphBuilder::buildDeployedGraph(
auto getSecondElement = [](auto const& _tuple){ return get<1>(_tuple); };
// Create graph for all publicly reachable functions
for (FunctionTypePointer functionType: _contract.interfaceFunctionList() | views::transform(getSecondElement))
for (FunctionTypePointer functionType: _contract.interfaceFunctionList() | ranges::views::transform(getSecondElement))
{
auto const* function = dynamic_cast<FunctionDefinition const*>(&functionType->declaration());
auto const* variable = dynamic_cast<VariableDeclaration const*>(&functionType->declaration());
@@ -305,7 +304,7 @@ ostream& solidity::frontend::operator<<(ostream& _out, CallGraph::Node const& _n
auto const* modifier = dynamic_cast<ModifierDefinition const *>(callableDeclaration);
auto typeToString = [](auto const& _var) -> string { return _var->type()->toString(true); };
vector<string> parameters = callableDeclaration->parameters() | views::transform(typeToString) | to<vector<string>>();
vector<string> parameters = callableDeclaration->parameters() | ranges::views::transform(typeToString) | ranges::to<vector<string>>();
string scopeName;
if (!function || !function->isFree())
+1 -2
View File
@@ -43,7 +43,6 @@
#include <type_traits>
#include <range/v3/view/map.hpp>
using namespace ranges;
using namespace std;
using namespace solidity::langutil;
@@ -271,7 +270,7 @@ bool ASTJsonConverter::visit(ContractDefinition const& _node)
make_pair("contractKind", contractKind(_node.contractKind())),
make_pair("abstract", _node.abstract()),
make_pair("baseContracts", toJson(_node.baseContracts())),
make_pair("contractDependencies", getContainerIds(_node.annotation().contractDependencies | views::keys)),
make_pair("contractDependencies", getContainerIds(_node.annotation().contractDependencies | ranges::views::keys)),
make_pair("usedErrors", getContainerIds(_node.interfaceErrors(false))),
make_pair("nodes", toJson(_node.subNodes())),
make_pair("scope", idOrNull(_node.scope()))
+4 -5
View File
@@ -22,7 +22,6 @@
#include <range/v3/view.hpp>
using namespace std;
using namespace ranges;
using namespace solidity;
using namespace solidity::frontend;
@@ -42,10 +41,10 @@ std::optional<ModelCheckerTargets> ModelCheckerTargets::fromString(string const&
{
set<TargetType> chosenTargets;
if (_targets == "default")
for (auto&& v: targetStrings | views::values)
for (auto&& v: targetStrings | ranges::views::values)
chosenTargets.insert(v);
else
for (auto&& t: _targets | views::split(',') | ranges::to<vector<string>>())
for (auto&& t: _targets | ranges::views::split(',') | ranges::to<vector<string>>())
{
if (!targetStrings.count(t))
return {};
@@ -69,9 +68,9 @@ std::optional<ModelCheckerContracts> ModelCheckerContracts::fromString(string co
if (_contracts == "default")
return ModelCheckerContracts::Default();
for (auto&& sourceContract: _contracts | views::split(',') | ranges::to<vector<string>>())
for (auto&& sourceContract: _contracts | ranges::views::split(',') | ranges::to<vector<string>>())
{
auto&& names = sourceContract | views::split(':') | ranges::to<vector<string>>();
auto&& names = sourceContract | ranges::views::split(':') | ranges::to<vector<string>>();
if (names.size() != 2 || names.at(0).empty() || names.at(1).empty())
return {};
chosen[names.at(0)].insert(names.at(1));