mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	class.c: exclude refined methods
* class.c (method_entry_i): should exclude refined methods from instance method list. [ruby-core:57080] [Bug #8881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									9d9dfc2172
								
							
						
					
					
						commit
						67129c8383
					
				
					 3 changed files with 20 additions and 0 deletions
				
			
		| 
						 | 
					@ -1,3 +1,8 @@
 | 
				
			||||||
 | 
					Tue Sep 10 12:39:17 2013  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* class.c (method_entry_i): should exclude refined methods from
 | 
				
			||||||
 | 
						  instance method list.  [ruby-core:57080] [Bug #8881]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Sep 10 12:05:04 2013  Kazuhiro NISHIYAMA  <zn@mbf.nifty.com>
 | 
					Tue Sep 10 12:05:04 2013  Kazuhiro NISHIYAMA  <zn@mbf.nifty.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* io.c (rb_f_printf): [DOC] add missing parenthesis in rdoc.
 | 
						* io.c (rb_f_printf): [DOC] add missing parenthesis in rdoc.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								class.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								class.c
									
										
									
									
									
								
							| 
						 | 
					@ -1121,6 +1121,10 @@ method_entry_i(st_data_t key, st_data_t value, st_data_t data)
 | 
				
			||||||
    st_table *list = (st_table *)data;
 | 
					    st_table *list = (st_table *)data;
 | 
				
			||||||
    long type;
 | 
					    long type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
 | 
				
			||||||
 | 
						me = rb_resolve_refined_method(Qnil, me, NULL);
 | 
				
			||||||
 | 
						if (!me) return ST_CONTINUE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (!st_lookup(list, key, 0)) {
 | 
					    if (!st_lookup(list, key, 0)) {
 | 
				
			||||||
	if (UNDEFINED_METHOD_ENTRY_P(me)) {
 | 
						if (UNDEFINED_METHOD_ENTRY_P(me)) {
 | 
				
			||||||
	    type = -1; /* none */
 | 
						    type = -1; /* none */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1005,6 +1005,17 @@ class TestRefinement < Test::Unit::TestCase
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_instance_methods
 | 
				
			||||||
 | 
					    bug8881 = '[ruby-core:57080] [Bug #8881]'
 | 
				
			||||||
 | 
					    assert_not_include(Foo.instance_methods(false), :z, bug8881)
 | 
				
			||||||
 | 
					    assert_not_include(FooSub.instance_methods(true), :z, bug8881)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_method_defined
 | 
				
			||||||
 | 
					    assert_not_send([Foo, :method_defined?, :z])
 | 
				
			||||||
 | 
					    assert_not_send([FooSub, :method_defined?, :z])
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private
 | 
					  private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def eval_using(mod, s)
 | 
					  def eval_using(mod, s)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue