mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	iseq.c: child iseq encoding
* iseq.c (iseq_inspect): preserve the encoding of child iseqs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									83ac2dfe0f
								
							
						
					
					
						commit
						64be4cfb5e
					
				
					 2 changed files with 7 additions and 2 deletions
				
			
		
							
								
								
									
										4
									
								
								iseq.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								iseq.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1780,8 +1780,8 @@ iseq_inspect(const rb_iseq_t *iseq)
 | 
			
		|||
	return rb_sprintf("#<ISeq: uninitialized>");
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	return rb_sprintf("#<ISeq:%s@%s:%d (%d,%d)-(%d,%d)>",
 | 
			
		||||
			  RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(rb_iseq_path(iseq)),
 | 
			
		||||
	return rb_sprintf("#<ISeq:%"PRIsVALUE"@%"PRIsVALUE":%d (%d,%d)-(%d,%d)>",
 | 
			
		||||
			  iseq->body->location.label, rb_iseq_path(iseq),
 | 
			
		||||
			  iseq->body->location.code_location.beg_pos.lineno,
 | 
			
		||||
			  iseq->body->location.code_location.beg_pos.lineno,
 | 
			
		||||
			  iseq->body->location.code_location.beg_pos.column,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,6 +91,11 @@ class TestISeq < Test::Unit::TestCase
 | 
			
		|||
    asm = compile(src).disasm
 | 
			
		||||
    assert_equal(src.encoding, asm.encoding)
 | 
			
		||||
    assert_predicate(asm, :valid_encoding?)
 | 
			
		||||
 | 
			
		||||
    obj = Object.new
 | 
			
		||||
    name = "\u{2603 26a1}"
 | 
			
		||||
    obj.instance_eval("def #{name}; tap {}; end")
 | 
			
		||||
    assert_include(RubyVM::InstructionSequence.of(obj.method(name)).disasm, name)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  LINE_BEFORE_METHOD = __LINE__
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue