From 79f3307c4be67ee1f9be1e90e4d5d2031e27ab8e Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Thu, 7 Mar 2019 19:28:20 -0800 Subject: [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. --- platform/darwin/src/NSExpression+MGLAdditions.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'platform/darwin/src/NSExpression+MGLAdditions.mm') 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:"]) { -- cgit v1.2.1