mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +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
|
@ -1,3 +1,9 @@
|
||||||
|
2008-11-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSObject.m: ([methodSignatureForSelector:]) Check that the
|
||||||
|
types of the selector (if known) and the types of the actual method
|
||||||
|
match. Raise an NSInternalInconsistencyException if they don't.
|
||||||
|
|
||||||
2008-11-23 Richard Frith-Macdonald <rfm@gnu.org>
|
2008-11-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/Additions/unicode/gsm0338.h: Add more mappings from unicode
|
* Source/Additions/unicode/gsm0338.h: Add more mappings from unicode
|
||||||
|
|
|
@ -1599,6 +1599,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
||||||
*/
|
*/
|
||||||
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
|
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
|
||||||
{
|
{
|
||||||
|
const char *selTypes;
|
||||||
const char *types;
|
const char *types;
|
||||||
struct objc_method *mth;
|
struct objc_method *mth;
|
||||||
Class c;
|
Class c;
|
||||||
|
@ -1607,6 +1608,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||||
|
|
||||||
|
selTypes = sel_get_type(aSelector);
|
||||||
c = (GSObjCIsInstance(self) ? GSObjCClass(self) : (Class)self);
|
c = (GSObjCIsInstance(self) ? GSObjCClass(self) : (Class)self);
|
||||||
mth = GSGetMethod(c, aSelector, GSObjCIsInstance(self), YES);
|
mth = GSGetMethod(c, aSelector, GSObjCIsInstance(self), YES);
|
||||||
|
|
||||||
|
@ -1663,6 +1665,13 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
||||||
{
|
{
|
||||||
return nil;
|
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];
|
return [NSMethodSignature signatureWithObjCTypes: types];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue