summaryrefslogtreecommitdiffstats
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
commit49bc6e7c8bf809166552c3463aad3c1570b4d4e5 (patch)
treea1826ada1b512c5ae1d51ebe782cd5555ea7bf16
parent0c7a3e5dd370b7b91e39b6ab727f14daec4fb583 (diff)
downloadruby-49bc6e7c8bf809166552c3463aad3c1570b4d4e5.tar.gz
ruby-49bc6e7c8bf809166552c3463aad3c1570b4d4e5.tar.xz
ruby-49bc6e7c8bf809166552c3463aad3c1570b4d4e5.zip
* eval_method.ci (remove_method): should not remove undef place
holder. [ruby-dev:31816], [ruby-dev:31817] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--eval_method.ci10
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c5316ba25..8e0537d34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Sep 25 13:43:03 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval_method.ci (remove_method): should not remove undef place
+ holder. [ruby-dev:31816], [ruby-dev:31817]
+
Tue Sep 25 09:51:31 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_longjmp): source file information may be NULL.
diff --git a/eval_method.ci b/eval_method.ci
index a647335ed..5dfcdfacb 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));
}