* vm_method.c (rb_add_method_def): no redefinition warning on

undef.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-10-03 12:19:19 +00:00
parent 74926fefb7
commit 9603cd2f62
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Sat Oct 3 21:19:18 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_method.c (rb_add_method_def): no redefinition warning on
undef.
Sat Oct 3 18:51:11 2009 Yukihiro Matsumoto <matz@ruby-lang.org> Sat Oct 3 18:51:11 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (rb_f_integer): now Integer() takes optional base * object.c (rb_f_integer): now Integer() takes optional base

View File

@ -150,7 +150,15 @@ class TestClass < Test::Unit::TestCase
Class.new do Class.new do
define_method(:foo) do end define_method(:foo) do end
alias bar foo alias bar foo
alias barf oo alias bar foo
end
end
assert_equal("", stderr)
stderr = EnvUtil.verbose_warning do
Class.new do
def foo; end
undef foo
end end
end end
assert_equal("", stderr) assert_equal("", stderr)

View File

@ -845,5 +845,13 @@ class TestModule < Test::Unit::TestCase
end end
end end
assert_equal("", stderr, '[ruby-dev:39397]') assert_equal("", stderr, '[ruby-dev:39397]')
stderr = EnvUtil.verbose_warning do
Module.new do
def foo; end
undef foo
end
end
assert_equal("", stderr)
end end
end end

View File

@ -185,6 +185,7 @@ rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definiti
rb_vm_check_redefinition_opt_method(old_me); rb_vm_check_redefinition_opt_method(old_me);
if (RTEST(ruby_verbose) && if (RTEST(ruby_verbose) &&
type != VM_METHOD_TYPE_UNDEF &&
old_def->alias_count == 0 && old_def->alias_count == 0 &&
old_def->type != VM_METHOD_TYPE_UNDEF && old_def->type != VM_METHOD_TYPE_UNDEF &&
old_def->type != VM_METHOD_TYPE_ZSUPER) { old_def->type != VM_METHOD_TYPE_ZSUPER) {