[前][次][番号順一覧][スレッド一覧]

ruby-changes:49651

From: nobu <ko1@a...>
Date: Thu, 11 Jan 2018 17:35:00 +0900 (JST)
Subject: [ruby-changes:49651] nobu:r61767 (trunk): iseq.c: child iseq encoding

nobu	2018-01-11 17:34:55 +0900 (Thu, 11 Jan 2018)

  New Revision: 61767

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61767

  Log:
    iseq.c: child iseq encoding
    
    * iseq.c (iseq_inspect): preserve the encoding of child iseqs.

  Modified files:
    trunk/iseq.c
    trunk/test/ruby/test_iseq.rb
Index: test/ruby/test_iseq.rb
===================================================================
--- test/ruby/test_iseq.rb	(revision 61766)
+++ test/ruby/test_iseq.rb	(revision 61767)
@@ -91,6 +91,11 @@ class TestISeq < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_iseq.rb#L91
     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__
Index: iseq.c
===================================================================
--- iseq.c	(revision 61766)
+++ iseq.c	(revision 61767)
@@ -1780,8 +1780,8 @@ iseq_inspect(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1780
 	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,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]