Add special case to KVC accessors for libobjc2: If there is a method with the

wrong types, try calling the method with the correct types.  This enables the
TDD-fixup code to run and generate a KVC-compliant version of an existing
method.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31412 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2010-09-24 19:31:46 +00:00
parent ec239ebfaf
commit 7563e320b5

View file

@ -59,6 +59,9 @@
#ifndef NeXT_RUNTIME
#include <pthread.h>
#endif
#ifdef __GNUSTEP_RUNTIME__
struct objc_slot* objc_get_slot(Class, SEL);
#endif
#ifdef NeXT_Foundation_LIBRARY
@interface NSObject (MissingFromMacOSX)
@ -1032,6 +1035,18 @@ case encoding: \
}
}
default:
#ifdef __GNUSTEP_RUNTIME__
{
Class cls = [self class];
struct objc_slot *type_slot = objc_get_slot(cls, @selector(retain));
SEL typed = sel_registerTypedName_np(sel_getName(sel), type_slot->types);
struct objc_slot *slot = objc_get_slot(cls, typed);
if (strcmp(slot->types, type_slot->types) == 0)
{
return slot->method(self, typed);
}
}
#endif
return [self valueForUndefinedKey: [NSString stringWithUTF8String: key]];
}
}