mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 20:26:42 +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
|
@ -437,17 +437,30 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
_set_arg(self, 0, &_target);
|
||||
_set_arg(self, 1, &_selector);
|
||||
|
||||
imp = method_get_imp(object_is_instance(_target) ?
|
||||
class_get_instance_method(
|
||||
((struct objc_class*)_target)->class_pointer, _selector)
|
||||
: class_get_class_method(
|
||||
((struct objc_class*)_target)->class_pointer, _selector));
|
||||
/*
|
||||
* If fast lookup failed, we may be forwarding or something ...
|
||||
*/
|
||||
if (imp == 0)
|
||||
imp = objc_msg_lookup(_target, _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)
|
||||
: class_get_class_method(
|
||||
((struct objc_class*)_target)->class_pointer, _selector));
|
||||
/*
|
||||
* If fast lookup failed, we may be forwarding or something ...
|
||||
*/
|
||||
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…
Add table
Add a link
Reference in a new issue