mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* 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
This commit is contained in:
parent
3d13252601
commit
ac7497416d
3 changed files with 16 additions and 6 deletions
9
eval.c
9
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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue