Quick runtime fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17099 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-07-04 11:18:51 +00:00
parent bde21db4d6
commit 03086200c9
2 changed files with 67 additions and 0 deletions

View file

@ -9,6 +9,7 @@ Fri Jul 4 11:09:37 2003 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSObject.m: ([methodSignatureForSelector:]) modified to take
into account any protocols that the receiver conforms to, so the
returned signature has the fullest possible type information.
Category Protocol(Fixup) ... evil hack to work around runtime bug.
* Source/GSFFCallInvocation.m: Fetch method signature from receiver
in preference to using other info. Ensures we have correct info for
the object we are sending the message to.

View file

@ -687,6 +687,72 @@ static IMP autorelease_imp;
static BOOL double_release_check_enabled = NO;
@implementation Protocol (Fixup)
struct objc_method_description_list {
int count;
struct objc_method_description list[1];
};
- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel
{
int i;
struct objc_protocol_list* proto_list;
const char* name = sel_get_name (aSel);
struct objc_method_description *result;
if (instance_methods != 0)
{
for (i = 0; i < instance_methods->count; i++)
{
if (!strcmp ((char*)instance_methods->list[i].name, name))
return &(instance_methods->list[i]);
}
}
for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
{
size_t j;
for (j=0; j < proto_list->count; j++)
{
if ((result = [proto_list->list[j]
descriptionForInstanceMethod: aSel]))
return result;
}
}
return NULL;
}
- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
{
int i;
struct objc_protocol_list* proto_list;
const char* name = sel_get_name (aSel);
struct objc_method_description *result;
if (class_methods != 0)
{
for (i = 0; i < class_methods->count; i++)
{
if (!strcmp ((char*)class_methods->list[i].name, name))
return &(class_methods->list[i]);
}
}
for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
{
size_t j;
for (j=0; j < proto_list->count; j++)
{
if ((result = [proto_list->list[j]
descriptionForClassMethod: aSel]))
return result;
}
}
return NULL;
}
@end
/**
* <p>