summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-21 19:16:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-21 19:16:40 +0000
commitc94f8ab926a524a633a739e8a2e69016e18354d2 (patch)
tree2fc23fc96b14d2ca655464352904e5bdfc799197 /eval.c
parentfb3c76a225a314a3583250ae6e92f41fce0e371f (diff)
* eval.c (rb_mod_define_method): allow binding methods to modules.
[ruby-dev:23410] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index e04ea39703..9f099cdca3 100644
--- a/eval.c
+++ b/eval.c
@@ -9098,7 +9098,8 @@ rb_mod_define_method(argc, argv, mod)
if (FL_TEST(rklass, FL_SINGLETON)) {
rb_raise(rb_eTypeError, "cannot bind singleton method to a different class");
}
- if (RCLASS(rklass)->super && !RTEST(rb_class_inherited_p(mod, rklass))) {
+ if (RCLASS(mod)->super && RCLASS(rklass)->super &&
+ !RTEST(rb_class_inherited_p(mod, rklass))) {
rb_raise(rb_eTypeError, "bind argument must be a subclass of %s",
rb_class2name(rklass));
}