mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-15 15:11:28 +00:00
New: optimise CPArray enumerateObjectsWithOptions:usingBlock:.
This commit is contained in:
@@ -631,8 +631,6 @@ var concat = Array.prototype.concat,
|
||||
|
||||
- (void)enumerateObjectsWithOptions:(CPEnumerationOptions)options usingBlock:(Function /*(id anObject, int idx, @ref BOOL stop)*/)aFunction
|
||||
{
|
||||
var shouldStop = NO;
|
||||
|
||||
if (options & CPEnumerationReverse)
|
||||
{
|
||||
var index = [self count] - 1,
|
||||
@@ -646,9 +644,12 @@ var concat = Array.prototype.concat,
|
||||
increment = 1;
|
||||
}
|
||||
|
||||
var shouldStop = NO,
|
||||
shouldStopRef = @ref(shouldStop);
|
||||
|
||||
for (; index !== stop; index += increment)
|
||||
{
|
||||
aFunction([self objectAtIndex:index], index, @ref(shouldStop));
|
||||
aFunction([self objectAtIndex:index], index, shouldStopRef);
|
||||
|
||||
if (shouldStop)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user