summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-01 13:44:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-01 13:44:21 +0000
commitac7497416dd6cac1a8c8a5ab35010da5a09ccc25 (patch)
tree1cf19cc7937039fa681429d160f16927e546a2fe /eval.c
parent3d132526012e4c9bad0389bf97b978cf6159abde (diff)
* eval.c (remove_method): should not remove undef place holder.
[ruby-dev:31817] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 5903dc97c1..ef1b278fd6 100644
--- a/eval.c
+++ b/eval.c
@@ -569,8 +569,13 @@ remove_method(klass, mid)
if (mid == __id__ || mid == __send__ || mid == init) {
rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
}
- if (!st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body) ||
- !body->nd_body) {
+ if (st_lookup(RCLASS(klass)->m_tbl, mid, (st_data_t *)&body)) {
+ if (!body || !body->nd_body) body = 0;
+ else {
+ st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body);
+ }
+ }
+ if (!body) {
rb_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}