summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-25 18:42:44 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-25 18:42:44 +0000
commiteca3835c65f6e63b92dd5387257322323ab43563 (patch)
tree91cd561d7c18bae1b00f925a4b374d909c9e9992 /vm_method.c
parentc4e838d011ac61ad30b2fa7c568caa11b34ee958 (diff)
merge revision(s) r48111,r48118,r48120: [Backport #10421]
* vm_method.c (rb_method_entry_make): warn redefinition only for already defined methods, but not for undefined methods. [ruby-dev:48691] [Bug #10421] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c
index a5fe4ba0a3..2270359029 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -181,6 +181,7 @@ rb_free_method_entry(rb_method_entry_t *me)
xfree(me);
}
+static inline rb_method_entry_t *search_method(VALUE klass, ID id, VALUE *defined_class_ptr);
static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2);
static inline rb_method_entry_t *
@@ -355,7 +356,7 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
}
/* check mid */
if (mid == object_id || mid == id__send__) {
- if (type == VM_METHOD_TYPE_ISEQ) {
+ if (type == VM_METHOD_TYPE_ISEQ && search_method(klass, mid, 0)) {
rb_warn("redefining `%s' may cause serious problems", rb_id2name(mid));
}
}