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
This commit is contained in:
CaS 2005-11-28 16:12:59 +00:00
parent 1bf4c4c303
commit fc0a2b7fc9

View file

@ -709,14 +709,32 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
} }
if (*u == nil) if (*u == nil)
{ {
NSEnumerator *e;
NSString *unit;
unsigned count = 0;
/** /**
* If the method was given no unit to look in, then it will succeed * 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 * 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 [t objectForKey: *u];
} }
return nil; return nil;