diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-30 04:15:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-30 04:15:46 +0000 |
commit | a71d47a380026de99aa64e84684e556937aae521 (patch) | |
tree | 93c3536ff19d3499e805a1e538e2f06694022fe5 /vm_method.c | |
parent | 331fdbe822046382c51eeddbd13ed81f90472402 (diff) | |
download | bundler-a71d47a380026de99aa64e84684e556937aae521.tar.gz |
* vm_method.c (rb_add_method_def): show the location where
overwritten method was defined. [ruby-dev:39400]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c index 808c64c47e..a879d0567f 100644 --- a/vm_method.c +++ b/vm_method.c @@ -188,7 +188,26 @@ rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definiti old_def->alias_count == 0 && old_def->type != VM_METHOD_TYPE_UNDEF && old_def->type != VM_METHOD_TYPE_ZSUPER) { + extern rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc); + rb_iseq_t *iseq = 0; + rb_warning("method redefined; discarding old %s", rb_id2name(mid)); + switch (old_def->type) { + case VM_METHOD_TYPE_ISEQ: + iseq = old_def->body.iseq; + break; + case VM_METHOD_TYPE_BMETHOD: + iseq = rb_proc_get_iseq(old_def->body.proc, 0); + break; + default: + break; + } + if (iseq && !NIL_P(iseq->filename)) { + int line = iseq->insn_info_table ? rb_iseq_first_lineno(iseq) : 0; + rb_compile_warning(RSTRING_PTR(iseq->filename), line, + "previous definition of %s was here", + rb_id2name(old_def->original_id)); + } } rb_free_method_entry(old_me); } |