summaryrefslogtreecommitdiff
path: root/include/mbgl/style/conversion/data_driven_property_value.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/style/conversion/data_driven_property_value.hpp')
-rw-r--r--include/mbgl/style/conversion/data_driven_property_value.hpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/include/mbgl/style/conversion/data_driven_property_value.hpp b/include/mbgl/style/conversion/data_driven_property_value.hpp
index 466d4b6402..b4297816df 100644
--- a/include/mbgl/style/conversion/data_driven_property_value.hpp
+++ b/include/mbgl/style/conversion/data_driven_property_value.hpp
@@ -44,19 +44,9 @@ struct Converter<DataDrivenPropertyValue<T>> {
} else if (!featureConstant && !zoomConstant) {
return DataDrivenPropertyValue<T>(CompositeFunction<T>(std::move(*expression)));
} else {
- // If an expression is neither zoom- nor feature-dependent, it
- // should have been reduced to a Literal when it was parsed.
- optional<T> constant;
- if (auto literal = dynamic_cast<Literal*>(expression->get())) {
- // cool, it's pre-folded to a literal
- constant = fromExpressionValue<T>(literal->getValue());
- } else {
- // we didn't manage to fold to a literal during parsing, so evaluate it now
- EvaluationContext params(nullptr);
- EvaluationResult evaluated((*expression)->evaluate(params));
- assert(evaluated);
- constant = fromExpressionValue<T>(*evaluated);
- }
+ auto literal = dynamic_cast<Literal*>(expression->get());
+ assert(literal);
+ optional<T> constant = fromExpressionValue<T>(literal->getValue());
if (!constant) {
return {};
}