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

ruby-changes:39897

From: usa <ko1@a...>
Date: Tue, 29 Sep 2015 17:40:48 +0900 (JST)
Subject: [ruby-changes:39897] usa:r51978 (ruby_2_1): merge revision(s) 51820: [Backport #11519]

usa	2015-09-29 17:40:40 +0900 (Tue, 29 Sep 2015)

  New Revision: 51978

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

  Log:
    merge revision(s) 51820: [Backport #11519]
    
    * parse.y (literal_concat_gen, evstr2dstr_gen): keep literal
      encoding beginning with an interpolation same as the source file
      encoding.  [ruby-core:70703] [Bug #11519]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/parse.y
    branches/ruby_2_1/test/ruby/test_literal.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 51977)
+++ ruby_2_1/ChangeLog	(revision 51978)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Tue Sep 29 17:39:42 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (literal_concat_gen, evstr2dstr_gen): keep literal
+	  encoding beginning with an interpolation same as the source file
+	  encoding.  [ruby-core:70703] [Bug #11519]
+
 Tue Sep 29 17:33:13 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/rss/rss.rb (Time#w3cdtf): fix zero-trimmed width of fraction
Index: ruby_2_1/parse.y
===================================================================
--- ruby_2_1/parse.y	(revision 51977)
+++ ruby_2_1/parse.y	(revision 51978)
@@ -8477,7 +8477,7 @@ literal_concat_gen(struct parser_params https://github.com/ruby/ruby/blob/trunk/ruby_2_1/parse.y#L8477
 
     htype = nd_type(head);
     if (htype == NODE_EVSTR) {
-	NODE *node = NEW_DSTR(Qnil);
+	NODE *node = NEW_DSTR(STR_NEW0());
 	head = list_append(node, head);
 	htype = NODE_DSTR;
     }
@@ -8550,7 +8550,7 @@ static NODE * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/parse.y#L8550
 evstr2dstr_gen(struct parser_params *parser, NODE *node)
 {
     if (nd_type(node) == NODE_EVSTR) {
-	node = list_append(NEW_DSTR(Qnil), node);
+	node = list_append(NEW_DSTR(STR_NEW0()), node);
     }
     return node;
 }
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 51977)
+++ ruby_2_1/version.h	(revision 51978)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.8"
 #define RUBY_RELEASE_DATE "2015-09-29"
-#define RUBY_PATCHLEVEL 404
+#define RUBY_PATCHLEVEL 405
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_1/test/ruby/test_literal.rb
===================================================================
--- ruby_2_1/test/ruby/test_literal.rb	(revision 51977)
+++ ruby_2_1/test/ruby/test_literal.rb	(revision 51978)
@@ -103,6 +103,15 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_literal.rb#L103
     assert_equal('FooBar', b, 'r3842')
   end
 
+  def test_dstring_encoding
+    bug11519 = '[ruby-core:70703] [Bug #11519]'
+    ['"foo#{}"', '"#{}foo"', '"#{}"'].each do |code|
+      a = eval("#-*- coding: utf-8 -*-\n#{code}")
+      assert_equal(Encoding::UTF_8, a.encoding,
+                   proc{"#{bug11519}: #{code}.encoding"})
+    end
+  end
+
   def test_dsymbol
     assert_equal :a3c, :"a#{1+2}c"
   end

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51820


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

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