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

ruby-changes:35966

From: nobu <ko1@a...>
Date: Mon, 20 Oct 2014 14:20:58 +0900 (JST)
Subject: [ruby-changes:35966] nobu:r48047 (trunk): vm_insnhelper.c: preserve encoding

nobu	2014-10-20 14:20:39 +0900 (Mon, 20 Oct 2014)

  New Revision: 48047

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

  Log:
    vm_insnhelper.c: preserve encoding
    
    * vm_insnhelper.c (vm_getivar): preserve variable name encoding in
      warning message.

  Modified files:
    trunk/test/ruby/test_module.rb
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 48046)
+++ vm_insnhelper.c	(revision 48047)
@@ -527,7 +527,7 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_c https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L527
 
 	if (UNLIKELY(val == Qundef)) {
 	    if (!is_attr && RTEST(ruby_verbose))
-		rb_warning("instance variable %s not initialized", rb_id2name(id));
+		rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id));
 	    val = Qnil;
 	}
 	return val;
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 48046)
+++ test/ruby/test_module.rb	(revision 48047)
@@ -1826,6 +1826,11 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1826
     assert_warning '' do
       assert_equal(42, a.ivar)
     end
+
+    name = "@\u{5909 6570}"
+    assert_warning(/instance variable #{name} not initialized/) do
+      assert_nil(a.instance_eval(name))
+    end
   end
 
   def test_uninitialized_attr

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

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