mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
5dfb5c0a5d
commit
7aad1fd58a
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,16 +323,30 @@ 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);
|
||||
|
||||
imp = method_get_imp(object_is_instance(_target) ?
|
||||
class_get_instance_method(
|
||||
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(
|
||||
: 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 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);
|
||||
|
|
|
@ -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…
Reference in a new issue