[macruby-changes] [423] MacRuby/branches/lrz_unstable
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 12 19:16:48 PDT 2008
Revision: 423
http://trac.macosforge.org/projects/ruby/changeset/423
Author: lsansonetti at apple.com
Date: 2008-08-12 19:16:48 -0700 (Tue, 12 Aug 2008)
Log Message:
-----------
wip
Modified Paths:
--------------
MacRuby/branches/lrz_unstable/class.c
MacRuby/branches/lrz_unstable/vm_method.c
Modified: MacRuby/branches/lrz_unstable/class.c
===================================================================
--- MacRuby/branches/lrz_unstable/class.c 2008-08-13 01:10:29 UTC (rev 422)
+++ MacRuby/branches/lrz_unstable/class.c 2008-08-13 02:16:48 UTC (rev 423)
@@ -610,12 +610,19 @@
methods = class_copyMethodList((Class)module, &methods_count);
if (methods != NULL) {
for (i = 0; i < methods_count; i++) {
- Method method = methods[i];
+ Method method = methods[i], method2;
DLOG("DEFI", "-[%s %s]", class_getName((Class)klass), (char *)method_getName(method));
- assert(class_addMethod((Class)klass,
- method_getName(method),
- method_getImplementation(method),
- method_getTypeEncoding(method)));
+
+ method2 = class_getInstanceMethod((Class)klass, method_getName(method));
+ if (method2 != NULL && method2 != class_getInstanceMethod((Class)RCLASS_SUPER(klass), method_getName(method))) {
+ method_setImplementation(method2, method_getImplementation(method));
+ }
+ else {
+ assert(class_addMethod((Class)klass,
+ method_getName(method),
+ method_getImplementation(method),
+ method_getTypeEncoding(method)));
+ }
}
free(methods);
}
Modified: MacRuby/branches/lrz_unstable/vm_method.c
===================================================================
--- MacRuby/branches/lrz_unstable/vm_method.c 2008-08-13 01:10:29 UTC (rev 422)
+++ MacRuby/branches/lrz_unstable/vm_method.c 2008-08-13 02:16:48 UTC (rev 423)
@@ -232,7 +232,7 @@
NODE *node;
if (klass == 0)
return NULL;
- node = rb_objc_method_node(klass, id, NULL, NULL);
+ node = rb_method_node(klass, id);
if (node != NULL) {
if (klassp != NULL) /* TODO honour klassp */
*klassp = klass;
@@ -315,7 +315,21 @@
rb_method_node(VALUE klass, ID id)
{
#if WITH_OBJC
- return rb_objc_method_node(klass, id, NULL, NULL);
+ NODE *node = rb_objc_method_node(klass, id, NULL, NULL);
+ if (node == NULL) {
+ const char *id_str = rb_id2name(id);
+ size_t slen = strlen(id_str);
+
+ if (id_str[slen - 1] == ':') {
+ return NULL;
+ }
+ else {
+ char buf[100];
+ snprintf(buf, sizeof buf, "%s:", id_str);
+ return rb_method_node(klass, rb_intern(buf));
+ }
+ }
+ return node;
#else
struct cache_entry *ent;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080812/bfc93c1a/attachment.html
More information about the macruby-changes
mailing list