From fc0a2b7fc9726a2a8cfc575829ef14daf9ab1873 Mon Sep 17 00:00:00 2001 From: CaS Date: Mon, 28 Nov 2005 16:12:59 +0000 Subject: [PATCH] Disambiguate methods in classes and protocols ... use the class version. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22113 72102866-910b-0410-8b05-ffd578937521 --- Tools/AGSIndex.m | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Tools/AGSIndex.m b/Tools/AGSIndex.m index fcf3f9d2f..d4cb022c3 100644 --- a/Tools/AGSIndex.m +++ b/Tools/AGSIndex.m @@ -709,14 +709,32 @@ setDirectory(NSMutableDictionary *dict, NSString *path) } if (*u == nil) { + NSEnumerator *e; + NSString *unit; + unsigned count = 0; + /** * If the method was given no unit to look in, then it will succeed * and return a value if (and only if) the required reference is - * defined only in one unit. + * defined only in one unit (excluding protocols). + * In the case where it is in two units (one of them a protocol) + * the class is taken in preference to the protocol. */ - if ([t count] == 1) + e = [t keyEnumerator]; + while ((unit = [e nextObject]) != nil) + { + *u = unit; + if ([unit hasPrefix: @"("] == NO) + { + if (count++ > 0) + { + *u = nil; // More than one match + break; + } + } + } + if (*u != nil) { - *u = [[t allKeys] lastObject]; return [t objectForKey: *u]; } return nil;