[macruby-changes] [544] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 1 22:47:12 PDT 2008
Revision: 544
http://trac.macosforge.org/projects/ruby/changeset/544
Author: lsansonetti at apple.com
Date: 2008-09-01 22:47:11 -0700 (Mon, 01 Sep 2008)
Log Message:
-----------
fixed rb_call_super(), used in StringIO
Modified Paths:
--------------
MacRuby/trunk/objc.m
MacRuby/trunk/vm_eval.c
Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m 2008-09-02 03:30:09 UTC (rev 543)
+++ MacRuby/trunk/objc.m 2008-09-02 05:47:11 UTC (rev 544)
@@ -1632,18 +1632,19 @@
IMP imp;
NODE *node;
- if (mid == ID_ALLOCATOR)
- sel = @selector(alloc);
- else
- sel = sel_registerName(rb_id2name(mid));
+ sel = mid == ID_ALLOCATOR
+ ? @selector(alloc)
+ : sel_registerName(rb_id2name(mid));
- if (psel != NULL)
+ if (psel != NULL) {
*psel = sel;
+ }
node = rb_objc_method_node2(mod, sel, &imp);
- if (pimp != NULL)
+ if (pimp != NULL) {
*pimp = imp;
+ }
if (imp == NULL) {
char buf[100];
@@ -1656,8 +1657,9 @@
strlcpy(buf, (char *)sel, sizeof buf);
strlcat(buf, ":", sizeof buf);
sel = sel_registerName(buf);
- if (psel != NULL)
+ if (psel != NULL) {
*psel = sel;
+ }
return rb_objc_method_node2(mod, sel, pimp);
}
Modified: MacRuby/trunk/vm_eval.c
===================================================================
--- MacRuby/trunk/vm_eval.c 2008-09-02 03:30:09 UTC (rev 543)
+++ MacRuby/trunk/vm_eval.c 2008-09-02 05:47:11 UTC (rev 544)
@@ -142,6 +142,46 @@
rb_bug("vm_call_super: should not be reached");
}
+#if WITH_OBJC
+ SEL sel;
+ IMP imp;
+
+ if (argc == 0) {
+ const char *id_str;
+ size_t id_str_len;
+
+ id_str = rb_id2name(id);
+ id_str_len = strlen(id_str);
+ if (id_str[id_str_len - 1] == ':') {
+ char buf[100];
+ strncpy(buf, id_str, sizeof buf);
+ buf[MIN(sizeof buf, id_str_len - 1)] = '\0';
+ id = rb_intern(buf);
+ }
+ }
+
+ body = rb_objc_method_node(klass, id, &imp, &sel);
+ if (body != NULL) {
+ body = body->nd_body;
+ return vm_call0(th, klass, recv, id, id, argc, argv, body, CALL_SUPER);
+ }
+ else if (imp != NULL) {
+ struct rb_objc_method_sig sig;
+ Method m;
+
+ m = class_getInstanceMethod((Class)klass, sel);
+ assert(m != NULL);
+ sig.argc = method_getNumberOfArguments(m);
+ sig.types = method_getTypeEncoding(m);
+ return rb_objc_call2(recv, klass, sel, imp, &sig, NULL, argc, (VALUE *)argv);
+ }
+ else {
+ dp(recv);
+ dp(klass);
+ dpi(id);
+ rb_bug("vm_call_super: not found");
+ }
+#else
body = rb_method_node(klass, id); /* this returns NODE_METHOD */
if (body) {
@@ -155,6 +195,7 @@
}
return vm_call0(th, klass, recv, id, id, argc, argv, body, CALL_SUPER);
+#endif
}
VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080901/f11f9a20/attachment.html
More information about the macruby-changes
mailing list