summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-24 07:35:57 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-24 07:35:57 (GMT)
commit136b5b752dc1b6143bcfb8985ef63a884fb510e4 (patch)
tree989b8bb8dfd05fc4d944d2ade6f5d362270eefdb /vm_method.c
parente0ed0012cb5752ff39eebd245aabba5d95bce986 (diff)
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
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/vm_method.c b/vm_method.c
index 498fd7e..923085f 100644
--- a/vm_method.c
+++ b/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);