Permalink
Browse files

Implemented a better way of detecting whether an object is a block

  • Loading branch information...
1 parent 96e47a7 commit 0872cede887863ebb9fb0d58d725bf784bcb92d0 @thestoics thestoics committed Apr 25, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 Kiwi/KWCaptureSpy.m
  2. +1 −1 Kiwi/KWObjCUtilities.h
  3. +2 −2 Kiwi/KWObjCUtilities.m
View
@@ -28,7 +28,7 @@ - (void)object:(id)anObject didReceiveInvocation:(NSInvocation *)anInvocation {
if (KWObjCTypeIsObject(objCType)) {
id argument = nil;
[anInvocation getMessageArgument:&argument atIndex:_argumentIndex];
- if (KWObjectIsStackBlock(argument)) {
+ if (KWObjCTypeIsBlock(objCType)) {
_argument = [argument copy];
} else {
_argument = [argument retain];
View
@@ -22,7 +22,7 @@ BOOL KWObjCTypeIsSelector(const char *objCType);
BOOL KWObjCTypeIsPointerToType(const char *objCType);
BOOL KWObjCTypeIsPointerLike(const char *objCType);
BOOL KWObjCTypeIsUnknown(const char *objCType);
-BOOL KWObjectIsStackBlock(id object);
+BOOL KWObjCTypeIsBlock(const char *objCType);
NSUInteger KWObjCTypeLength(const char *objCType);
View
@@ -80,8 +80,8 @@ NSUInteger KWObjCTypeLength(const char *objCType) {
return [signature methodReturnLength];
}
-BOOL KWObjectIsStackBlock(id object) {
- return [object isKindOfClass:NSClassFromString(@"__NSStackBlock__")];
+BOOL KWObjCTypeIsBlock(const char *objCType) {
+ return strcmp(objCType, "@?") == 0;
}

0 comments on commit 0872ced

Please sign in to comment.