From 1ecb29fbf81f9fee8e599c51b071d4e4ae558fc1 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 4 Jun 2008 10:17:30 +0000 Subject: merge revision(s) 13586: * 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_6@16816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index c12c08b5d9..8bb4bb1f15 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)); } -- cgit v1.2.3