diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | eval_method.ci | 10 |
2 files changed, 13 insertions, 2 deletions
@@ -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)); } |