mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fixed [NSObject +conformsToProtocol:] and [NSObject -conformsToProtocol:]
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31769 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
30f098f9f8
commit
ba3fac5d5b
2 changed files with 21 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* Source/NSObject.m ([+conformsToProtocol:]): Fixed to iterate
|
||||
over superclasses. Just calling class_conformsToProtcol() is not
|
||||
enough as class_conformsToProtocol() does not iterate over
|
||||
superclasses.
|
||||
([-conformsToProtocol:]): Updated.
|
||||
|
||||
2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* configure.ac: Check for objc_setUncaughtExceptionHandler().
|
||||
|
|
|
@ -1298,7 +1298,18 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
|||
*/
|
||||
+ (BOOL) conformsToProtocol: (Protocol*)aProtocol
|
||||
{
|
||||
return class_conformsToProtocol(self, aProtocol);
|
||||
Class c;
|
||||
|
||||
/* Iterate over the current class and all the superclasses. */
|
||||
for (c = self; c != Nil; c = class_getSuperclass (c))
|
||||
{
|
||||
if (class_conformsToProtocol(c, aProtocol))
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1307,7 +1318,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
|||
*/
|
||||
- (BOOL) conformsToProtocol: (Protocol*)aProtocol
|
||||
{
|
||||
return class_conformsToProtocol([self class], aProtocol);
|
||||
return [[self class] conformsToProtocol: aProtocol];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue