mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Add check of method types in -methodSignatureForSelector:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27135 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
109d269742
commit
69effed5ac
2 changed files with 15 additions and 0 deletions
|
@ -1599,6 +1599,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
*/
|
||||
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
|
||||
{
|
||||
const char *selTypes;
|
||||
const char *types;
|
||||
struct objc_method *mth;
|
||||
Class c;
|
||||
|
@ -1607,6 +1608,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
selTypes = sel_get_type(aSelector);
|
||||
c = (GSObjCIsInstance(self) ? GSObjCClass(self) : (Class)self);
|
||||
mth = GSGetMethod(c, aSelector, GSObjCIsInstance(self), YES);
|
||||
|
||||
|
@ -1663,6 +1665,13 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
{
|
||||
return nil;
|
||||
}
|
||||
else if (selTypes != 0 && GSSelectorTypesMatch(selTypes, types) == NO)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"[%@%c%@] selector types (%s) don't match method types (%s)",
|
||||
NSStringFromClass(c), (GSObjCIsInstance(self) ? '-' : '+'),
|
||||
NSStringFromSelector(aSelector), selTypes, types];
|
||||
}
|
||||
return [NSMethodSignature signatureWithObjCTypes: types];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue