mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_method.c: remove common code
* vm_method.c (rb_undef): remove code almost common to proc.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e0ed0012cb
commit
136b5b752d
1 changed files with 1 additions and 16 deletions
17
vm_method.c
17
vm_method.c
|
@ -1118,22 +1118,7 @@ rb_undef(VALUE klass, ID id)
|
|||
|
||||
if (UNDEFINED_METHOD_ENTRY_P(me) ||
|
||||
UNDEFINED_REFINED_METHOD_P(me->def)) {
|
||||
const char *s0 = " class";
|
||||
VALUE c = klass;
|
||||
|
||||
if (FL_TEST(c, FL_SINGLETON)) {
|
||||
VALUE obj = rb_ivar_get(klass, attached);
|
||||
|
||||
if (RB_TYPE_P(obj, T_MODULE) || RB_TYPE_P(obj, T_CLASS)) {
|
||||
c = obj;
|
||||
s0 = "";
|
||||
}
|
||||
}
|
||||
else if (RB_TYPE_P(c, T_MODULE)) {
|
||||
s0 = " module";
|
||||
}
|
||||
rb_name_error(id, "undefined method `%"PRIsVALUE"' for%s `%"PRIsVALUE"'",
|
||||
QUOTE_ID(id), s0, rb_class_name(c));
|
||||
rb_method_name_error(klass, rb_id2str(id));
|
||||
}
|
||||
|
||||
rb_add_method(klass, id, VM_METHOD_TYPE_UNDEF, 0, METHOD_VISI_PUBLIC);
|
||||
|
|
Loading…
Reference in a new issue