From d07d8f6857d89701c4d99ac25fb006a36779b26d Mon Sep 17 00:00:00 2001 From: cacaodev Date: Thu, 4 Feb 2016 21:50:31 +0100 Subject: [PATCH] _CPBlockExpression: replace loops with arrayByApplyingBlock: method --- Foundation/CPPredicate/_CPBlockExpression.j | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Foundation/CPPredicate/_CPBlockExpression.j b/Foundation/CPPredicate/_CPBlockExpression.j index 299f250ee..6b91b3967 100644 --- a/Foundation/CPPredicate/_CPBlockExpression.j +++ b/Foundation/CPPredicate/_CPBlockExpression.j @@ -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];