diff --git a/Foundation/CPArray/_CPArray.j b/Foundation/CPArray/_CPArray.j index 8d8e1fd9a..98759ea44 100755 --- a/Foundation/CPArray/_CPArray.j +++ b/Foundation/CPArray/_CPArray.j @@ -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;