Revision
2878
Author
eloy.de.enige@gmail.com
Date
2009-10-21 15:53:56 -0700 (Wed, 21 Oct 2009)

Log Message

Raise a NameError when trying to remove a method in the superclass.

Modified Paths

Diff

Modified: MacRuby/trunk/spec/frozen/tags/macruby/core/module/remove_method_tags.txt (2877 => 2878)


--- MacRuby/trunk/spec/frozen/tags/macruby/core/module/remove_method_tags.txt	2009-10-21 21:23:16 UTC (rev 2877)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/module/remove_method_tags.txt	2009-10-21 22:53:56 UTC (rev 2878)
@@ -1,2 +1 @@
 fails:Module#remove_method removes method from subclass, but not parent
-fails:Module#remove_method raises a NameError when attempting to remove method further up the inheritance tree

Modified: MacRuby/trunk/vm_method.c (2877 => 2878)


--- MacRuby/trunk/vm_method.c	2009-10-21 21:23:16 UTC (rev 2877)
+++ MacRuby/trunk/vm_method.c	2009-10-21 22:53:56 UTC (rev 2878)
@@ -139,7 +139,8 @@
 	    m = class_getInstanceMethod((Class)klass, sel);
 	}
     }
-    if (m == NULL) {
+    if (m == NULL
+        || class_getInstanceMethod((Class)RCLASS_SUPER(klass), sel) == m) {
 	rb_name_error(mid, "method `%s' not defined in %s",
 		      rb_id2name(mid), rb_class2name(klass));
     }