mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +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
|
* Source/NSString.m: ([stringByDeletingPathExtension]) rewrite to
|
||||||
conform to MacOS-X documentation.
|
conform to MacOS-X documentation.
|
||||||
([pathComponents]) ditto.
|
([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>
|
2001-05-14 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
NSArgumentInfo *_info;
|
NSArgumentInfo *_info;
|
||||||
BOOL _argsRetained;
|
BOOL _argsRetained;
|
||||||
BOOL _validReturn;
|
BOOL _validReturn;
|
||||||
|
BOOL _sendToSuper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -86,6 +87,8 @@
|
||||||
- (id) initWithSelector: (SEL)aSelector;
|
- (id) initWithSelector: (SEL)aSelector;
|
||||||
- (id) initWithTarget: target selector: (SEL)aSelector, ...;
|
- (id) initWithTarget: target selector: (SEL)aSelector, ...;
|
||||||
- (void*) returnFrame: (arglist_t)argFrame;
|
- (void*) returnFrame: (arglist_t)argFrame;
|
||||||
|
- (BOOL) sendsToSuper;
|
||||||
|
- (void) setSendsToSuper: (BOOL)flag;
|
||||||
@end
|
@end
|
||||||
#endif
|
#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, 0, &_target, _info[1].size);
|
||||||
callframe_set_arg((callframe_t *)_cframe, 1, &_selector, _info[2].size);
|
callframe_set_arg((callframe_t *)_cframe, 1, &_selector, _info[2].size);
|
||||||
|
|
||||||
imp = method_get_imp(object_is_instance(_target) ?
|
if (_sendToSuper == YES)
|
||||||
class_get_instance_method(
|
{
|
||||||
|
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)
|
((struct objc_class*)_target)->class_pointer, _selector)
|
||||||
: class_get_class_method(
|
: class_get_class_method(
|
||||||
((struct objc_class*)_target)->class_pointer, _selector));
|
((struct objc_class*)_target)->class_pointer, _selector));
|
||||||
/*
|
/*
|
||||||
* If fast lookup failed, we may be forwarding or something ...
|
* If fast lookup failed, we may be forwarding or something ...
|
||||||
*/
|
*/
|
||||||
if (imp == 0)
|
if (imp == 0)
|
||||||
imp = objc_msg_lookup(_target, _selector);
|
imp = objc_msg_lookup(_target, _selector);
|
||||||
|
}
|
||||||
|
|
||||||
[self setTarget: old_target];
|
[self setTarget: old_target];
|
||||||
RELEASE(old_target);
|
RELEASE(old_target);
|
||||||
|
|
|
@ -437,17 +437,30 @@ _arg_addr(NSInvocation *inv, int index)
|
||||||
_set_arg(self, 0, &_target);
|
_set_arg(self, 0, &_target);
|
||||||
_set_arg(self, 1, &_selector);
|
_set_arg(self, 1, &_selector);
|
||||||
|
|
||||||
imp = method_get_imp(object_is_instance(_target) ?
|
if (_sendToSuper == YES)
|
||||||
class_get_instance_method(
|
{
|
||||||
((struct objc_class*)_target)->class_pointer, _selector)
|
Super s;
|
||||||
: 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);
|
|
||||||
|
|
||||||
|
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];
|
[self setTarget: old_target];
|
||||||
RELEASE(old_target);
|
RELEASE(old_target);
|
||||||
|
|
||||||
|
@ -717,6 +730,17 @@ _arg_addr(NSInvocation *inv, int index)
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) sendsToSuper
|
||||||
|
{
|
||||||
|
return _sendToSuper;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setSendsToSuper: (BOOL)flag
|
||||||
|
{
|
||||||
|
_sendToSuper = flag;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSInvocation (BackwardCompatibility)
|
@implementation NSInvocation (BackwardCompatibility)
|
||||||
|
|
Loading…
Reference in a new issue