New: optimise CPArray enumerateObjectsWithOptions:usingBlock:.

This commit is contained in:
Alexander Ljungberg
2013-03-10 13:09:24 +00:00
parent f4096b94a7
commit c550cd7afb
+4 -3
View File
@@ -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;