diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-30 15:04:41 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-30 17:17:38 -0700 |
commit | 9a1bb1ad14e18433d4cc8e805af57a6014275561 (patch) | |
tree | 60533ceadc7bebe48d655041b9c4dbcf4133c32a /include/mbgl/style/conversion/data_driven_property_value.hpp | |
parent | bf7785618ac5f3bbcba068e61ef6359d70aff92b (diff) | |
download | qtlocation-mapboxgl-9a1bb1ad14e18433d4cc8e805af57a6014275561.tar.gz |
[core] Tweak conversions to reduce binary size
* return {} → return nullopt
* error = { "..." } → error.message = "..."
Diffstat (limited to 'include/mbgl/style/conversion/data_driven_property_value.hpp')
-rw-r--r-- | include/mbgl/style/conversion/data_driven_property_value.hpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/mbgl/style/conversion/data_driven_property_value.hpp b/include/mbgl/style/conversion/data_driven_property_value.hpp index 59d197b216..2d8817ecf4 100644 --- a/include/mbgl/style/conversion/data_driven_property_value.hpp +++ b/include/mbgl/style/conversion/data_driven_property_value.hpp @@ -29,8 +29,8 @@ struct Converter<DataDrivenPropertyValue<T>> { ParsingContext ctx(valueTypeToExpressionType<T>()); ParseResult parsed = ctx.parseLayerPropertyExpression(value); if (!parsed) { - error = { ctx.getCombinedErrors() }; - return {}; + error.message = ctx.getCombinedErrors(); + return nullopt; } expression = PropertyExpression<T>(std::move(*parsed)); } else if (isObject(value)) { @@ -38,26 +38,26 @@ struct Converter<DataDrivenPropertyValue<T>> { } else { optional<T> constant = convert<T>(value, error); if (!constant) { - return {}; + return nullopt; } return convertTokens ? maybeConvertTokens(*constant) : DataDrivenPropertyValue<T>(*constant); } if (!expression) { - return {}; + return nullopt; } else if (!(*expression).isFeatureConstant() || !(*expression).isZoomConstant()) { return { std::move(*expression) }; } else if ((*expression).getExpression().getKind() == Kind::Literal) { optional<T> constant = fromExpressionValue<T>( static_cast<const Literal&>((*expression).getExpression()).getValue()); if (!constant) { - return {}; + return nullopt; } return DataDrivenPropertyValue<T>(*constant); } else { assert(false); - error = { "expected a literal expression" }; - return {}; + error.message = "expected a literal expression"; + return nullopt; } } |