[macruby-changes] [330] MacRuby/trunk/objc.m
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 8 00:21:36 PDT 2008
Revision: 330
http://trac.macosforge.org/projects/ruby/changeset/330
Author: lsansonetti at apple.com
Date: 2008-07-08 00:21:35 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
fixed super calls on anonymous classes
Modified Paths:
--------------
MacRuby/trunk/objc.m
Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m 2008-07-08 05:48:41 UTC (rev 329)
+++ MacRuby/trunk/objc.m 2008-07-08 07:21:35 UTC (rev 330)
@@ -1229,7 +1229,7 @@
rb_objc_rval_to_ocid(rcv, (void **)&ocrcv, true);
super_call = (ruby_current_thread->cfp->flag >> FRAME_MAGIC_MASK_BITS)
& VM_CALL_SUPER_BIT;
- klass = super_call ? class_getSuperclass(*(Class *)ocrcv) : *(Class *)ocrcv;
+ klass = *(Class *)ocrcv;
assert(rb_current_cfunc_node != NULL);
@@ -1262,6 +1262,21 @@
rb_current_cfunc_node->u3.value;
}
+ if (super_call) {
+ Class sklass = klass;
+ for (;;) {
+ Method smethod;
+ sklass = class_getSuperclass(sklass);
+ if (sklass == NULL)
+ break;
+ smethod = class_getInstanceMethod(sklass, ctx->selector);
+ if (smethod != ctx->method) {
+ klass = sklass;
+ break;
+ }
+ }
+ }
+
//NSLog(@"Ruby -> ObjC [%@ klass=%@ sel=%s argc=%d super_call=%d", ocrcv, (id)klass, (char *)ctx->selector, argc, super_call);
return rb_objc_call_objc(argc, argv, ocrcv, klass, super_call, ctx);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080708/e22716fc/attachment-0001.html
More information about the macruby-changes
mailing list