mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Extensions for invoking super implementation of method.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9952 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6f53907c90
commit
8a89977c96
4 changed files with 64 additions and 18 deletions
|
@ -3,6 +3,11 @@
|
|||
* Source/NSString.m: ([stringByDeletingPathExtension]) rewrite to
|
||||
conform to MacOS-X documentation.
|
||||
([pathComponents]) ditto.
|
||||
* Headers/Foundation/NSInvocation.h: Added extra methods for
|
||||
setting an invocation to invoke super implementation of method.
|
||||
* Source/NSInvocation.m: Added extra methods for
|
||||
setting an invocation to invoke super implementation of method.
|
||||
* Source/GSFFCallInvocation.m: support invoke of super implementation.
|
||||
|
||||
2001-05-14 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
NSArgumentInfo *_info;
|
||||
BOOL _argsRetained;
|
||||
BOOL _validReturn;
|
||||
BOOL _sendToSuper;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -86,6 +87,8 @@
|
|||
- (id) initWithSelector: (SEL)aSelector;
|
||||
- (id) initWithTarget: target selector: (SEL)aSelector, ...;
|
||||
- (void*) returnFrame: (arglist_t)argFrame;
|
||||
- (BOOL) sendsToSuper;
|
||||
- (void) setSendsToSuper: (BOOL)flag;
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
|
|
@ -323,6 +323,19 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
callframe_set_arg((callframe_t *)_cframe, 0, &_target, _info[1].size);
|
||||
callframe_set_arg((callframe_t *)_cframe, 1, &_selector, _info[2].size);
|
||||
|
||||
if (_sendToSuper == YES)
|
||||
{
|
||||
Super s;
|
||||
|
||||
s.self = _target;
|
||||
if (GSObjCIsInstance(_target))
|
||||
s.class = class_get_super_class(GSObjCClass(_target));
|
||||
else
|
||||
s.class = class_get_super_class((Class)_target);
|
||||
imp = objc_msg_lookup_super(&s, _selector);
|
||||
}
|
||||
else
|
||||
{
|
||||
imp = method_get_imp(object_is_instance(_target) ?
|
||||
class_get_instance_method(
|
||||
((struct objc_class*)_target)->class_pointer, _selector)
|
||||
|
@ -333,6 +346,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
*/
|
||||
if (imp == 0)
|
||||
imp = objc_msg_lookup(_target, _selector);
|
||||
}
|
||||
|
||||
[self setTarget: old_target];
|
||||
RELEASE(old_target);
|
||||
|
|
|
@ -437,6 +437,19 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
_set_arg(self, 0, &_target);
|
||||
_set_arg(self, 1, &_selector);
|
||||
|
||||
if (_sendToSuper == YES)
|
||||
{
|
||||
Super s;
|
||||
|
||||
s.self = _target;
|
||||
if (GSObjCIsInstance(_target))
|
||||
s.class = class_get_super_class(GSObjCClass(_target));
|
||||
else
|
||||
s.class = class_get_super_class((Class)_target);
|
||||
imp = objc_msg_lookup_super(&s, _selector);
|
||||
}
|
||||
else
|
||||
{
|
||||
imp = method_get_imp(object_is_instance(_target) ?
|
||||
class_get_instance_method(
|
||||
((struct objc_class*)_target)->class_pointer, _selector)
|
||||
|
@ -447,7 +460,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
*/
|
||||
if (imp == 0)
|
||||
imp = objc_msg_lookup(_target, _selector);
|
||||
|
||||
}
|
||||
[self setTarget: old_target];
|
||||
RELEASE(old_target);
|
||||
|
||||
|
@ -717,6 +730,17 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
[self subclassResponsibility: _cmd];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- (BOOL) sendsToSuper
|
||||
{
|
||||
return _sendToSuper;
|
||||
}
|
||||
|
||||
- (void) setSendsToSuper: (BOOL)flag
|
||||
{
|
||||
_sendToSuper = flag;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSInvocation (BackwardCompatibility)
|
||||
|
|
Loading…
Reference in a new issue