CPMutableArray fixes and tests.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2011-01-11 15:27:35 -08:00
parent 3e45c7895c
commit 1f5ad49591
3 changed files with 133 additions and 33 deletions
+11
View File
@@ -238,6 +238,17 @@ var concat = Array.prototype.concat,
self[anIndex] = anObject;
}
- (void)replaceObjectsInRange:(CPRange)aRange withObjectsFromArray:(CPArray)anArray range:(CPRange)otherRange
{
if (otherRange && (otherRange.location !== 0 || otherRange.length !== [anArray count]))
anArray = [anArray subarrayWithRange:otherRange];
if (anArray.isa !== _CPJavaScriptArray)
anArray = [anArray _javaScriptArrayCopy];
splice.apply(self, [aRange.location, aRange.length].concat(anArray));
}
- (void)setArray:(CPArray)anArray
{
if (anArray.isa === _CPJavaScriptArray)