1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval_method.h: add redefine checks ([ruby-dev:30751]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-05-02 06:21:58 +00:00
parent f53a94c831
commit 1db71b2eca
2 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Wed May 2 15:14:56 2007 Koichi Sasada <ko1@atdot.net>
* eval_method.h: add redefine checks ([ruby-dev:30751]).
Wed May 2 11:22:52 2007 Koichi Sasada <ko1@atdot.net>
* compile.c: use Qtrue instead of 2.

View file

@ -293,6 +293,11 @@ remove_method(VALUE klass, ID mid)
rb_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}
if (nd_type(body->nd_body->nd_body) == NODE_CFUNC) {
rb_vm_check_redefinition_opt_method(body);
}
rb_clear_cache_for_undef(klass, mid);
if (FL_TEST(klass, FL_SINGLETON)) {
rb_funcall(rb_iv_get(klass, "__attached__"), singleton_removed, 1,
@ -559,11 +564,15 @@ rb_alias(VALUE klass, ID name, ID def)
orig_fbody->nd_cnt++;
if (RTEST(ruby_verbose) &&
st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *) & node)) {
if (node && node->nd_cnt == 0 && node->nd_body) {
if (st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *) & node)) {
if (node) {
if (RTEST(ruby_verbose) && node->nd_cnt == 0 && node->nd_body) {
rb_warning("discarding old %s", rb_id2name(name));
}
if (nd_type(node->nd_body->nd_body) == NODE_CFUNC) {
rb_vm_check_redefinition_opt_method(node);
}
}
}
st_insert(RCLASS(klass)->m_tbl, name,