More tests and bug fixes for CPArray family.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2011-01-11 12:08:00 -08:00
1 parent 29301f440e
commit 3e45c7895c
5 files changed
+526 -296

No files matched your search

+29
View File
@@ -218,16 +218,45 @@ var concat = Array.prototype.concat,
push.call(self, anObject);
}
- (void)removeAllObjects
{
splice.call(self, 0, self.length);
}
- (void)removeLastObject
{
pop.call(self);
}
- (void)removeObjectsInRange:(CPRange)aRange
{
splice.call(self, aRange.location, aRange.length);
}
- (void)replaceObjectAtIndex:(int)anIndex withObject:(id)anObject
{
self[anIndex] = anObject;
}
- (void)setArray:(CPArray)anArray
{
if (anArray.isa === _CPJavaScriptArray)
splice.apply(self, [0, self.length].concat(anArray));
else
[super setArray:anArray];
}
- (void)addObjectsFromArray:(CPArray)anArray
{
if (anArray.isa === _CPJavaScriptArray)
splice.apply(self, [self.length, 0].concat(anArray));
else
[super addObjectsFromArray:anArray];
}
- (void)copy
{
return slice.call(self, 0);