diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2019-03-07 19:28:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 19:28:20 -0800 |
commit | 79f3307c4be67ee1f9be1e90e4d5d2031e27ab8e (patch) | |
tree | 192396b53664ca8b983453e1ced4ce36582d0904 /platform/darwin/src/NSExpression+MGLAdditions.mm | |
parent | d0ffaa4245802c2081f899eaed80b730558c9227 (diff) | |
download | qtlocation-mapboxgl-79f3307c4be67ee1f9be1e90e4d5d2031e27ab8e.tar.gz |
[ios, macos] Fix a bug with multiple format expressions. (#14064)
Fixed a bug where `format` expressions using the generic `MGL_FUNCTION` binding ignored multiple formatting parameters.
Diffstat (limited to 'platform/darwin/src/NSExpression+MGLAdditions.mm')
-rw-r--r-- | platform/darwin/src/NSExpression+MGLAdditions.mm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index 527cb64b3d..6aaba4dd90 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -1126,7 +1126,19 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { if (firstOp.expressionType == NSConstantValueExpressionType && [firstOp.constantValue isEqualToString:@"format"]) { // Avoid wrapping format options object in literal expression. - return @[@"format", self.arguments[1].mgl_jsonExpressionObject, self.arguments[2].constantValue]; + NSMutableArray *expressionObject = [NSMutableArray array]; + [expressionObject addObject:@"format"]; + + for (NSUInteger index = 1; index < self.arguments.count; index++) { + if (index % 2 == 1) { + [expressionObject addObject:self.arguments[index].mgl_jsonExpressionObject]; + } else { + [expressionObject addObject:self.arguments[index].constantValue]; + } + + } + + return expressionObject; } return self.arguments.mgl_jsonExpressionObject; } else if (op == [MGLColor class] && [function isEqualToString:@"colorWithRed:green:blue:alpha:"]) { |