mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Guess at types when given untyped selector.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10613 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d6febadbdf
commit
fc5dd011c6
2 changed files with 27 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2001-07-31 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFFCallInvocation.m: attempt to guess type signature
|
||||
when compiler gives us an untyped selector.
|
||||
|
||||
2001-07-30 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Headers/gnustep/base/NSObjCRuntime.h: Export additional functions
|
||||
|
|
|
@ -374,6 +374,28 @@ void GSInvocationCallback(void *callback_data, va_alist args)
|
|||
|
||||
callback_sel = *(SEL *)callback_data;
|
||||
callback_type = sel_get_type(callback_sel);
|
||||
|
||||
/*
|
||||
* Make a guess at what the type signature might be by asking the
|
||||
* runtime for a selector with the same name as the untyped one we
|
||||
* were given.
|
||||
*/
|
||||
if (callback_type == NULL)
|
||||
{
|
||||
const char *name = sel_get_name(callback_sel);
|
||||
|
||||
if (name != NULL)
|
||||
{
|
||||
SEL sel = sel_get_any_typed_uid(name);
|
||||
|
||||
if (sel != NULL)
|
||||
{
|
||||
callback_sel = sel;
|
||||
callback_type = sel_get_type(callback_sel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (callback_type == NULL)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Invalid selector %s (no type information)",
|
||||
|
|
Loading…
Reference in a new issue