diff --git a/ChangeLog b/ChangeLog index 8870b0b19d..e405730742 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,10 @@ -Sun Sep 13 00:03:01 2009 Nobuyoshi Nakada +Sun Sep 13 00:21:02 2009 Nobuyoshi Nakada * vm_method.c (rb_add_method, rb_add_method_me): call method added hook after definition. [ruby-core:25536] + * vm_method.c (rb_alias): hooks are called from rb_add_method_def. + Sat Sep 12 22:47:24 2009 Tanaka Akira * lib/open-uri.rb (URI::FTP#buffer_open): use the port specified in diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 23fce969dd..38eefc29e3 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -769,9 +769,21 @@ class TestModule < Test::Unit::TestCase end def f end + alias g f + attr_reader :a + attr_writer :a end assert_equal :f, memo.shift - assert_equal mod.instance_methods(false), memo.shift + assert_equal [:f], memo.shift, '[ruby-core:25536]' assert_equal mod.instance_method(:f), memo.shift + assert_equal :g, memo.shift + assert_equal [:f, :g], memo.shift + assert_equal mod.instance_method(:f), memo.shift + assert_equal :a, memo.shift + assert_equal [:f, :g, :a], memo.shift + assert_equal mod.instance_method(:a), memo.shift + assert_equal :a=, memo.shift + assert_equal [:f, :g, :a, :a=], memo.shift + assert_equal mod.instance_method(:a=), memo.shift end end diff --git a/vm_method.c b/vm_method.c index c263defda2..61fc8cb793 100644 --- a/vm_method.c +++ b/vm_method.c @@ -827,7 +827,6 @@ void rb_alias(VALUE klass, ID name, ID def) { rb_method_entry_t *orig_me; - VALUE singleton = 0; rb_frozen_class_p(klass); if (klass == rb_cObject) { @@ -842,22 +841,8 @@ rb_alias(VALUE klass, ID name, ID def) rb_print_undef(klass, def, 0); } } - if (FL_TEST(klass, FL_SINGLETON)) { - singleton = rb_iv_get(klass, "__attached__"); - } rb_add_method_me(klass, name, orig_me, orig_me->flag); - - if (!ruby_running) return; - - rb_clear_cache_by_id(name); - - if (singleton) { - rb_funcall(singleton, singleton_added, 1, ID2SYM(name)); - } - else { - rb_funcall(klass, added, 1, ID2SYM(name)); - } } /*