[core] to-color should be idempotent

Ports https://github.com/mapbox/mapbox-gl-js/pull/7260.
This commit is contained in:
John Firebaugh
2018-09-11 13:21:14 -07:00
parent df93047d40
commit c044dd88b2

View File

@@ -30,6 +30,9 @@ EvaluationResult toNumber(const Value& v) {
EvaluationResult toColor(const Value& colorValue) {
return colorValue.match(
[&](const Color& color) -> EvaluationResult {
return color;
},
[&](const std::string& colorString) -> EvaluationResult {
const optional<Color> result = Color::parse(colorString);
if (result) {