Remove tabs; Update some of the toll free bridging code.

This commit is contained in:
Ross Boucher
2010-12-08 15:44:28 -08:00
parent 901f3fe63b
commit 1e2fdc3e1b
5 changed files with 31 additions and 21 deletions
+2 -2
View File
@@ -108,8 +108,8 @@ CPEnumerationReverse = 1 << 1;
*/
+ (id)alloc
{
var result = [];
result.isa = [self class];
var result = [];
result.isa = [self class];
return result;
}
+1 -1
View File
@@ -444,7 +444,7 @@ _cappdefaultDcmHandler = [CPDecimalNumberHandler decimalNumberHandlerWithRoundin
*/
- (CPString)hash
{
objj_exception_throw("hash: NOT YET IMPLEMENTED");
[CPException raise:CPUnsupportedMethodException reason:"hash: NOT YET IMPLEMENTED"];
}
/*!
+17 -9
View File
@@ -54,8 +54,9 @@ if (input == nil)
*/
+ (id)alloc
{
if ([self class] !== CPException) return [super alloc];
return new Error();
var result = new Error();
result.isa = [self class];
return result;
}
/*!
@@ -89,9 +90,7 @@ if (input == nil)
*/
- (id)initWithName:(CPString)aName reason:(CPString)aReason userInfo:(CPDictionary)aUserInfo
{
self = [super init];
if (self)
if (self = [super init])
{
name = aName;
message = aReason;
@@ -141,6 +140,17 @@ if (input == nil)
throw self;
}
- (BOOL)isEqual:(id)anObject
{
if (!anObject || !anObject.isa)
return NO;
return [anObject isKindOfClass:CPException] &&
name === [anObject name] &&
message === [anObject message] &&
(_userInfo === [anObject userInfo] || ([_userInfo isEqual:[anObject userInfo]]));
}
@end
@implementation CPException (CPCopying)
@@ -165,9 +175,7 @@ var CPExceptionNameKey = "CPExceptionNameKey",
*/
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
if (self = [super init])
{
name = [aCoder decodeObjectForKey:CPExceptionNameKey];
message = [aCoder decodeObjectForKey:CPExceptionReasonKey];
@@ -193,7 +201,7 @@ var CPExceptionNameKey = "CPExceptionNameKey",
// toll-free bridge Error to CPException
// [CPException alloc] uses an objj_exception, which is a subclass of Error
Error.prototype.isa = CPException;
Error.prototype._userInfo = NULL;
Error.prototype._userInfo = null;
[CPException initialize];
+2 -2
View File
@@ -43,8 +43,8 @@ var __placeholder = new Number(),
+ (id)alloc
{
var result = new Number();
result.isa = [self class];
var result = new Number();
result.isa = [self class];
return result;
}
+9 -7
View File
@@ -91,7 +91,9 @@ var CPStringRegexSpecialCharacters = [
*/
+ (id)alloc
{
if ([self class] !== CPString) return [super alloc];
if ([self class] !== CPString)
return [super alloc];
return new String;
}
@@ -433,7 +435,7 @@ var CPStringRegexSpecialCharacters = [
- (CPString)stringByReplacingCharactersInRange:(CPRange)range withString:(CPString)replacement
{
return '' + substring(0, range.location) + replacement + substring(range.location + range.length, self.length);
return '' + substring(0, range.location) + replacement + substring(range.location + range.length, self.length);
}
/*!
@@ -485,8 +487,8 @@ var CPStringRegexSpecialCharacters = [
if(aMask & CPDiacriticInsensitiveSearch)
{
lhs = lhs.stripDiacritics();
rhs = rhs.stripDiacritics();
lhs = lhs.stripDiacritics();
rhs = rhs.stripDiacritics();
}
if (lhs < rhs)
@@ -715,9 +717,9 @@ var CPStringRegexSpecialCharacters = [
}
/*!
Deletes the last path component of a string.
This method assumes that the string's content is a '/'
separated file system path.
Deletes the last path component of a string.
This method assumes that the string's content is a '/'
separated file system path.
*/
- (CPString)stringByDeletingLastPathComponent
{