1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_method.c (rb_remove_method_id): no definition body is

undefined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-09-12 15:27:59 +00:00
parent 0ab4b21d81
commit 2fcdd7e080
2 changed files with 15 additions and 14 deletions

View file

@ -1,4 +1,7 @@
Sun Sep 13 00:21:02 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sun Sep 13 00:27:57 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_method.c (rb_remove_method_id): no definition body is
undefined.
* vm_method.c (rb_add_method, rb_add_method_me): call method added
hook after definition. [ruby-core:25536]

View file

@ -368,8 +368,8 @@ rb_method_entry(VALUE klass, ID id)
return rb_get_method_entry(klass, id);
}
void
rb_remove_method_id(VALUE klass, ID mid)
static void
remove_method_id(VALUE klass, ID mid)
{
st_data_t data;
rb_method_entry_t *me = 0;
@ -386,19 +386,13 @@ rb_remove_method_id(VALUE klass, ID mid)
rb_warn("removing `%s' may cause serious problems", rb_id2name(mid));
}
if (st_lookup(RCLASS_M_TBL(klass), mid, &data)) {
me = (rb_method_entry_t *)data;
if (!me || (me->def && me->def->type == VM_METHOD_TYPE_UNDEF)) {
me = 0;
}
else {
st_delete(RCLASS_M_TBL(klass), &mid, &data);
}
}
if (!me) {
if (!st_lookup(RCLASS_M_TBL(klass), mid, &data) ||
!(me = (rb_method_entry_t *)data) ||
(!me->def || me->def->type == VM_METHOD_TYPE_UNDEF)) {
rb_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}
st_delete(RCLASS_M_TBL(klass), &mid, &data);
rb_vm_check_redefinition_opt_method(me);
rb_clear_cache_for_undef(klass, mid);
@ -412,7 +406,11 @@ rb_remove_method_id(VALUE klass, ID mid)
}
}
#define remove_method(klass, mid) rb_remove_method_id(klass, mid)
void
rb_remove_method_id(VALUE klass, ID mid)
{
remove_method(klass, mid);
}
void
rb_remove_method(VALUE klass, const char *name)