[macruby-changes] [3161] MacRuby/trunk/vm_method.c

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 22 21:03:51 PST 2009


Revision: 3161
          http://trac.macosforge.org/projects/ruby/changeset/3161
Author:   lsansonetti at apple.com
Date:     2009-12-22 21:03:51 -0800 (Tue, 22 Dec 2009)
Log Message:
-----------
when changing the visibility of a method and duplicating its entry in the lookup table, be sure to keep the same flags too

Modified Paths:
--------------
    MacRuby/trunk/vm_method.c

Modified: MacRuby/trunk/vm_method.c
===================================================================
--- MacRuby/trunk/vm_method.c	2009-12-23 05:00:54 UTC (rev 3160)
+++ MacRuby/trunk/vm_method.c	2009-12-23 05:03:51 UTC (rev 3161)
@@ -209,10 +209,20 @@
 
     VALUE sklass = RCLASS_SUPER(klass);
     if (sklass != 0) {
-	Method m = class_getInstanceMethod((Class)sklass, sel);
-	if (m != NULL && method_getImplementation(m) == node->objc_imp) {
+	IMP imp;
+	rb_vm_method_node_t *snode;
+	if (rb_vm_lookup_method((Class)sklass, sel, &imp, &snode)
+		&& imp == node->objc_imp) {
 	    // The method actually exists on a superclass, we need to duplicate
-	    // it to the current class.
+	    // it to the current class, keeping the same flags.
+	    if (snode != NULL) {
+		if (snode->flags & VM_METHOD_EMPTY) {
+		    flags |= VM_METHOD_EMPTY;
+		}
+		if (snode->flags & VM_METHOD_FBODY) {
+		    flags |= VM_METHOD_FBODY;
+		}
+	    }
 	    rb_vm_define_method2((Class)klass, sel, node, flags, false);
 	    return;
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091222/310b56ec/attachment.html>


More information about the macruby-changes mailing list