mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
class.c: rb_undef_methods_from
* class.c (rb_undef_methods_from): undefine methods defined in super from klass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3bda73868f
commit
4065c38a6a
3 changed files with 23 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Oct 24 10:49:50 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* class.c (rb_undef_methods_from): undefine methods defined in
|
||||
super from klass.
|
||||
|
||||
Mon Oct 24 10:19:44 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* complex.c (Init_Complex): undefine Complex#clamp, which does not
|
||||
|
|
17
class.c
17
class.c
|
@ -1528,6 +1528,23 @@ rb_undef_method(VALUE klass, const char *name)
|
|||
rb_add_method(klass, rb_intern(name), VM_METHOD_TYPE_UNDEF, 0, METHOD_VISI_UNDEF);
|
||||
}
|
||||
|
||||
static enum rb_id_table_iterator_result
|
||||
undef_method_i(ID name, VALUE value, void *data)
|
||||
{
|
||||
VALUE klass = (VALUE)data;
|
||||
rb_add_method(klass, name, VM_METHOD_TYPE_UNDEF, 0, METHOD_VISI_UNDEF);
|
||||
return ID_TABLE_CONTINUE;
|
||||
}
|
||||
|
||||
void
|
||||
rb_undef_methods_from(VALUE klass, VALUE super)
|
||||
{
|
||||
struct rb_id_table *mtbl = RCLASS_M_TBL(super);
|
||||
if (mtbl) {
|
||||
rb_id_table_foreach(mtbl, undef_method_i, (void *)klass);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \}
|
||||
*/
|
||||
|
|
|
@ -931,6 +931,7 @@ VALUE rb_singleton_class_get(VALUE obj);
|
|||
void Init_class_hierarchy(void);
|
||||
|
||||
int rb_class_has_methods(VALUE c);
|
||||
void rb_undef_methods_from(VALUE klass, VALUE super);
|
||||
|
||||
/* compar.c */
|
||||
VALUE rb_invcmp(VALUE, VALUE);
|
||||
|
|
Loading…
Add table
Reference in a new issue