mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-26 21:47:04 +00:00
More tests and bug fixes for CPArray family.
Reviewed by me.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user