... and check superclasses when checking protocol conformance.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30589 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2010-06-06 21:08:14 +00:00
parent 1b1baeac00
commit 7a176201c6

View file

@ -1066,22 +1066,26 @@ BOOL class_conformsToProtocol(Class cls, Protocol *protocol)
{ {
struct objc_protocol_list *protocols; struct objc_protocol_list *protocols;
for (protocols = cls->protocols; while (cls)
protocols != NULL ; protocols = protocols->next)
{ {
int i; for (protocols = cls->protocols;
for (i=0 ; i<protocols->count ; i++) protocols != NULL ; protocols = protocols->next)
{ {
Protocol *p1 = (Protocol*)protocols->list[i]; int i;
if (strcmp(p1->protocol_name, protocol->protocol_name) == 0) for (i=0 ; i<protocols->count ; i++)
{ {
return YES; Protocol *p1 = (Protocol*)protocols->list[i];
} if (strcmp(p1->protocol_name, protocol->protocol_name) == 0)
if (protocol_conformsToProtocol(p1, protocol)) {
{ return YES;
return YES; }
if (protocol_conformsToProtocol(p1, protocol))
{
return YES;
}
} }
} }
cls = cls ->super_class;
} }
return NO; return NO;
} }