mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-07 01:18:02 +00:00
_CPBlockExpression: replace loops with arrayByApplyingBlock: method
This commit is contained in:
1 parent
0327f6b1ea
commit
d07d8f6857
1 file changed
+4
-8
@@ -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];
|
||||
|
||||
Reference in new issue
Block a user