mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* vm_method.c (rb_alias): hooks are called from rb_add_method_def.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									d7feab06cc
								
							
						
					
					
						commit
						efa4ed8cce
					
				
					 3 changed files with 16 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -1,8 +1,10 @@
 | 
			
		|||
Sun Sep 13 00:03:01 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
Sun Sep 13 00:21:02 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* 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  <akr@fsij.org>
 | 
			
		||||
 | 
			
		||||
	* lib/open-uri.rb (URI::FTP#buffer_open): use the port specified in
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								vm_method.c
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								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));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue