summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-09-16 18:25:17 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-09-17 11:16:42 +0300
commite3421e042fe720d4d7b13457c4597921f31f3bcd (patch)
treec3df1b9ce6914fda3b240fff2fcfc25fb62ba915 /src
parenta99240a54ffd5eb77568d41e10186411b1b759eb (diff)
downloadqtlocation-mapboxgl-e3421e042fe720d4d7b13457c4597921f31f3bcd.tar.gz
[core] Fix for FormatSectionOverrides::hasOverride
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/style/layers/symbol_layer_impl.hpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/mbgl/style/layers/symbol_layer_impl.hpp b/src/mbgl/style/layers/symbol_layer_impl.hpp
index 9b63e0e8d6..ca9505a5f3 100644
--- a/src/mbgl/style/layers/symbol_layer_impl.hpp
+++ b/src/mbgl/style/layers/symbol_layer_impl.hpp
@@ -74,7 +74,7 @@ struct FormatSectionOverrides<TypeList<PaintProperty...>> {
},
[&checkLiteral] (const PropertyExpression<TextField::Type>& property) {
bool expressionHasOverrides = false;
- const auto checkExpression = [&](const expression::Expression& e) {
+ const std::function<void(const expression::Expression&)> checkExpression = [&](const expression::Expression& e) {
if (expressionHasOverrides) {
return;
}
@@ -87,9 +87,7 @@ struct FormatSectionOverrides<TypeList<PaintProperty...>> {
expressionHasOverrides = true;
}
return;
- }
-
- if (e.getKind() == expression::Kind::FormatExpression) {
+ } else if (e.getKind() == expression::Kind::FormatExpression) {
const auto* formatExpr = static_cast<const expression::FormatExpression*>(&e);
for (const auto& section : formatExpr->getSections()) {
if (Property::hasOverride(section)) {
@@ -97,17 +95,12 @@ struct FormatSectionOverrides<TypeList<PaintProperty...>> {
break;
}
}
+ } else {
+ e.eachChild(checkExpression);
}
};
- // Check root property expression and return early.
checkExpression(property.getExpression());
- if (expressionHasOverrides) {
- return true;
- }
-
- // Traverse thru children and check whether any of them have overrides.
- property.getExpression().eachChild(checkExpression);
return expressionHasOverrides;
},
[] (const auto&) {