summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-03 12:19:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-03 12:19:19 +0000
commit7211354a565892ae77bfdac90142a596f3661ca7 (patch)
tree24a1181ea6e641e9b59e8cb320cec66649a54c84
parentd66ad8c8d6c73fb9fa715f78b15889ab5c3e876e (diff)
downloadruby-7211354a565892ae77bfdac90142a596f3661ca7.tar.gz
ruby-7211354a565892ae77bfdac90142a596f3661ca7.tar.xz
ruby-7211354a565892ae77bfdac90142a596f3661ca7.zip
* vm_method.c (rb_add_method_def): no redefinition warning on
undef. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_class.rb10
-rw-r--r--test/ruby/test_module.rb8
-rw-r--r--vm_method.c1
4 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5838a5cc8..07893ce70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* object.c (rb_f_integer): now Integer() takes optional base
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb
index 409fc49e4..8fe127231 100644
--- a/test/ruby/test_class.rb
+++ b/test/ruby/test_class.rb
@@ -150,7 +150,15 @@ class TestClass < Test::Unit::TestCase
Class.new do
define_method(:foo) do end
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
assert_equal("", stderr)
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index c50cd38b7..59c965325 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -845,5 +845,13 @@ class TestModule < Test::Unit::TestCase
end
end
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
diff --git a/vm_method.c b/vm_method.c
index a879d0567..ec381c40d 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -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);
if (RTEST(ruby_verbose) &&
+ type != VM_METHOD_TYPE_UNDEF &&
old_def->alias_count == 0 &&
old_def->type != VM_METHOD_TYPE_UNDEF &&
old_def->type != VM_METHOD_TYPE_ZSUPER) {