OSDN Git Service

(conformsTo:): Change implementati to allways use class to do lookup.
authorkrab <krab@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Sep 1994 15:28:04 +0000 (15:28 +0000)
committerkrab <krab@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Sep 1994 15:28:04 +0000 (15:28 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8030 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/objc/Object.m

index 040df86..1716d1d 100644 (file)
@@ -194,12 +194,17 @@ extern int errno;
 
 // Indicates if the receiving class or instance conforms to the given protocol
 // not usually overridden by subclasses
-- (BOOL) conformsTo: (Protocol*)aProtocol
+//
+// Modified 9/5/94 to always search the class object's protocol list, rather
+// than the meta class.
+
++ (BOOL) conformsTo: (Protocol*)aProtocol
 {
   int i;
   struct objc_protocol_list* proto_list;
+  id parent;
 
-  for (proto_list = isa->protocols;
+  for (proto_list = ((Class*)self)->protocols;
        proto_list; proto_list = proto_list->next)
     {
       for (i=0; i < proto_list->count; i++)
@@ -209,12 +214,17 @@ extern int errno;
       }
     }
 
-  if ([self superClass])
-    return [[self superClass] conformsTo: aProtocol];
+  if (parent = [self superClass])
+    return [parent conformsTo: aProtocol];
   else
     return NO;
 }
 
+- (BOOL) conformsTo: (Protocol*)aProtocol
+{
+  return [[self class] conformsTo:aProtocol];
+}
+
 - (IMP)methodFor:(SEL)aSel
 {
   return (method_get_imp(object_is_instance(self)