Add implementation of expressionValueWithObject:context: to GSAggregateExpression

This commit is contained in:
Gregory John Casamento 2024-05-28 15:03:26 -04:00
parent a49ae59a79
commit 48ab2e2bc7
2 changed files with 17 additions and 4 deletions

View file

@ -158,10 +158,7 @@ NSExpression:
+ expressionForSubquery:usingIteratorVariable:predicate:
+ expressionForFunction:selectorName:arguments:
+ expressionForBlock:arguments:
- collection
- predicate
- leftExpression
- rightExpression
- expressionBlock
-------------------------------------------------------------
NSFileHandle:

View file

@ -48,6 +48,7 @@
#import "Foundation/NSValue.h"
#import "GSPrivate.h"
#import "GSFastEnumeration.h"
// For pow()
#include <math.h>
@ -1297,7 +1298,7 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
e = [[GSAggregateExpression alloc]
initWithExpressionType: NSAggregateExpressionType];
ASSIGN(e->_collection, [NSMutableArray array]);
ASSIGN(e->_collection, subExpressions);
return AUTORELEASE(e);
}
@ -1808,6 +1809,21 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
return _collection;
}
- (id) expressionValueWithObject: (id)object
context: (NSMutableDictionary *)context
{
NSMutableArray *result = [NSMutableArray arrayWithCapacity:
[_collection count]];
FOR_IN(NSExpression*, exp, _collection)
{
NSExpression *value = [exp expressionValueWithObject: object context: context];
[result addObject: value];
}
END_FOR_IN(_collection);
return result;
}
@end
@implementation GSFunctionExpression