summaryrefslogtreecommitdiff
path: root/eval_method.ci
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-25 12:41:48 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-25 12:41:48 +0000
commita50ef07e16b8d09073c34ba3124868b22917972f (patch)
treea1826ada1b512c5ae1d51ebe782cd5555ea7bf16 /eval_method.ci
parent72ea36112ced7623337aead592fe8dbd4d4d1998 (diff)
* eval_method.ci (remove_method): should not remove undef place
holder. [ruby-dev:31816], [ruby-dev:31817] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_method.ci')
-rw-r--r--eval_method.ci10
1 files changed, 8 insertions, 2 deletions
diff --git a/eval_method.ci b/eval_method.ci
index a647335ed6..5dfcdfacb6 100644
--- a/eval_method.ci
+++ b/eval_method.ci
@@ -305,8 +305,14 @@ remove_method(VALUE klass, ID mid)
if (mid == object_id || mid == __send || mid == __send_bang || mid == init) {
rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
}
- if (!st_delete(RCLASS(klass)->m_tbl, &mid, &data) ||
- !(body = (NODE *)data) || !body->nd_body) {
+ if (st_lookup(RCLASS(klass)->m_tbl, mid, &data)) {
+ body = (NODE *)data;
+ if (!body || !body->nd_body) body = 0;
+ else {
+ st_delete(RCLASS(klass)->m_tbl, &mid, &data);
+ }
+ }
+ if (!body) {
rb_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}