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:
Richard Frith-Macdonald 2005-11-28 16:12:59 +00:00
parent fa19407f5a
commit 39e544280e

View file

@ -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;