From c5f84dc3341fe43d344b682a6a77380db5a90d8d Mon Sep 17 00:00:00 2001
From: Marcel Greter <marcel.greter@ocbnet.ch>
Date: Sat, 18 May 2019 18:46:55 +0200
Subject: [PATCH 10/12] Alter for range loops for replace script
---
src/ast_selectors.cpp | 6 +++---
src/ast_values.cpp | 8 ++++----
src/check_nesting.cpp | 2 +-
src/context.cpp | 8 ++++----
src/extend.cpp | 3 ++-
src/subset_map.cpp | 2 +-
6 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/ast_selectors.cpp b/src/ast_selectors.cpp
index a8576489..be447202 100644
--- a/src/ast_selectors.cpp
+++ b/src/ast_selectors.cpp
@@ -471,7 +471,7 @@ namespace Sass {
bool Compound_Selector::has_parent_ref() const
{
- for (Simple_Selector_Obj s : *this) {
+ for (Simple_Selector_Obj s : elements()) {
if (s && s->has_parent_ref()) return true;
}
return false;
@@ -479,7 +479,7 @@ namespace Sass {
bool Compound_Selector::has_real_parent_ref() const
{
- for (Simple_Selector_Obj s : *this) {
+ for (Simple_Selector_Obj s : elements()) {
if (s && s->has_real_parent_ref()) return true;
}
return false;
@@ -506,7 +506,7 @@ namespace Sass {
std::array<std::set<std::string>, 2> pseudosets;
std::array<const Compound_Selector*, 2> compounds = {{this, rhs}};
for (int i = 0; i < 2; ++i) {
- for (const Simple_Selector_Obj& el : compounds[i]->elements()) {
+ for (auto el : compounds[i]->elements()) {
if (el->is_pseudo_element()) {
std::string pseudo(el->to_string());
// strip off colons to ensure :after matches ::after since ruby sass is forgiving
diff --git a/src/ast_values.cpp b/src/ast_values.cpp
index 8473e410..3b49036b 100644
--- a/src/ast_values.cpp
+++ b/src/ast_values.cpp
@@ -330,7 +330,7 @@ namespace Sass {
if (hash_ == 0) {
hash_ = std::hash<std::string>()(name());
for (auto argument : arguments()->elements())
- hash_combine(hash_, argument->hash());
+ { hash_combine(hash_, argument->hash()); }
}
return hash_;
}
@@ -429,9 +429,9 @@ namespace Sass {
if (hash_ == 0) {
hash_ = std::hash<double>()(value_);
for (const auto numerator : numerators)
- hash_combine(hash_, std::hash<std::string>()(numerator));
+ { hash_combine(hash_, std::hash<std::string>()(numerator)); }
for (const auto denominator : denominators)
- hash_combine(hash_, std::hash<std::string>()(denominator));
+ { hash_combine(hash_, std::hash<std::string>()(denominator)); }
}
return hash_;
}
@@ -810,7 +810,7 @@ namespace Sass {
{
if (hash_ == 0) {
for (auto string : elements())
- hash_combine(hash_, string->hash());
+ { hash_combine(hash_, string->hash()); }
}
return hash_;
}
diff --git a/src/check_nesting.cpp b/src/check_nesting.cpp
index b6ab1faa..3b6a5909 100644
--- a/src/check_nesting.cpp
+++ b/src/check_nesting.cpp
@@ -129,7 +129,7 @@ namespace Sass {
this->visit_children(i);
if (Block* b = Cast<Block>(i->alternative())) {
- for (auto n : b->elements()) n->perform(this);
+ for (auto n : b->elements()) { n->perform(this); }
}
return i;
diff --git a/src/context.cpp b/src/context.cpp
index 088a70d3..73e118db 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -112,10 +112,10 @@ namespace Sass {
collect_plugin_paths(c_options.plugin_paths);
// load plugins and register custom behaviors
- for(auto plug : plugin_paths) plugins.load_plugins(plug);
- for(auto fn : plugins.get_headers()) c_headers.push_back(fn);
- for(auto fn : plugins.get_importers()) c_importers.push_back(fn);
- for(auto fn : plugins.get_functions()) c_functions.push_back(fn);
+ for(auto plug : plugin_paths) { plugins.load_plugins(plug); }
+ for(auto fn : plugins.get_headers()) { c_headers.push_back(fn); }
+ for(auto fn : plugins.get_importers()) { c_importers.push_back(fn); }
+ for(auto fn : plugins.get_functions()) { c_functions.push_back(fn); }
// sort the items by priority (lowest first)
sort (c_headers.begin(), c_headers.end(), sort_importers);
diff --git a/src/extend.cpp b/src/extend.cpp
index 3470dc93..d9f20e8c 100644
--- a/src/extend.cpp
+++ b/src/extend.cpp
@@ -2087,7 +2087,8 @@ namespace Sass {
// we set `extended` flag on extended selectors
if (b->is_root()) {
// debug_subset_map(subset_map);
- for(auto const &it : subset_map.values()) {
+ std::vector<SubSetMapPair> sm = subset_map.values();
+ for(const auto &it : sm) {
const Complex_Selector* sel = nullptr;
const Compound_Selector* ext = nullptr;
if (it.first) sel = it.first->first();
diff --git a/src/subset_map.cpp b/src/subset_map.cpp
index 11586f30..f8c8fa99 100644
--- a/src/subset_map.cpp
+++ b/src/subset_map.cpp
@@ -27,7 +27,7 @@ namespace Sass {
continue;
}
const std::vector<std::pair<Compound_Selector_Obj, size_t> >& subsets = hash_[(*sel)[i]];
- for (const std::pair<Compound_Selector_Obj, size_t>& item : subsets) {
+ for (const auto& item : subsets) {
bool include = true;
for (const Simple_Selector_Obj& it : item.first->elements()) {
auto found = dict.find(it);
--
2.21.0.windows.1