_CPBlockExpression: replace loops with arrayByApplyingBlock: method

This commit is contained in:
cacaodev committed 2016-02-04 21:51:37 +01:00
1 parent 0327f6b1ea
commit d07d8f6857
1 file changed
+4 -8
+4 -8
View File
@@ -53,11 +53,9 @@
- (id)expressionValueWithObject:(id)object context:(CPDictionary)context
{
var args = [];
[_arguments enumerateObjectsUsingBlock:function(exp, idx)
var args = [_arguments arrayByApplyingBlock:function(exp, _)
{
[args addObject:[exp expressionValueWithObject:object context:context]];
return [exp expressionValueWithObject:object context:context];
}];
return _block(object, args, context);
@@ -65,11 +63,9 @@
- (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)bindings
{
var args = [];
[_arguments enumerateObjectsUsingBlock:function(exp, idx)
var args = [_arguments arrayByApplyingBlock:function(exp, _)
{
[args addObject:[exp _expressionWithSubstitutionVariables:bindings]];
return [exp _expressionWithSubstitutionVariables:bindings];
}];
return [[_CPBlockExpression alloc] initWithBlock:_block arguments:args];