Revision
2855
Author
eloy.de.enige@gmail.com
Date
2009-10-19 16:36:46 -0700 (Mon, 19 Oct 2009)

Log Message

If a method has been removed, with remove_method, make sure respond_to returns false.

Modified Paths

Diff

Modified: MacRuby/trunk/dispatcher.cpp (2854 => 2855)


--- MacRuby/trunk/dispatcher.cpp	2009-10-19 23:36:38 UTC (rev 2854)
+++ MacRuby/trunk/dispatcher.cpp	2009-10-19 23:36:46 UTC (rev 2855)
@@ -555,18 +555,12 @@
 recache2:
 	    IMP imp = method_getImplementation(method);
 
-	    if (UNDEFINED_IMP(imp)) {
+	    if (UNDEFINED_IMP(imp)
+			|| (REMOVED_IMP(imp)
+				&& rb_vm_super_lookup((VALUE)klass, sel) == NULL)) {
 		// Method was undefined.
 		goto call_method_missing;
 	    }
-	    else if (REMOVED_IMP(imp)) {
-	        // Method was removed, let's see if any of the ancestors does
-	        // implement the method.
-	        method = rb_vm_super_lookup((VALUE)klass, sel);
-	        if (method == NULL) {
-	            goto call_method_missing;
-	        }
-	    }
 
 	    rb_vm_method_node_t *node = GET_CORE()->method_node_get(method);
 
@@ -1777,7 +1771,10 @@
 	    }
 	}
 
-	if (m == NULL || UNDEFINED_IMP(method_getImplementation(m))) {
+	IMP imp = method_getImplementation(m);
+	if (UNDEFINED_IMP(imp)
+	    || (REMOVED_IMP(imp)
+	        && rb_vm_super_lookup((VALUE)klass, sel) == NULL)) {
 	    return false;
 	}