summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-27 04:28:03 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-27 04:28:03 +0000
commit2c31816f1abd48cadda2e91262e0b30913fe1694 (patch)
tree89510593ffe15d2d822e2c5da12fdcd0673270d1 /vm_method.c
parent4a5d839ceb4f08aff4843abc6b369b12a97e02e7 (diff)
merge revision(s) 48111,48118,48120: [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_0_0@48149 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 8af656cd1e..0258f36d99 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -172,6 +172,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 *
@@ -332,7 +333,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));
}
}