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

ruby-changes:40694

From: nagachika <ko1@a...>
Date: Sat, 28 Nov 2015 06:39:16 +0900 (JST)
Subject: [ruby-changes:40694] nagachika:r52773 (ruby_2_2): merge revision(s) 51820: [Backport #11519]

nagachika	2015-11-28 06:38:54 +0900 (Sat, 28 Nov 2015)

  New Revision: 52773

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

  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_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/parse.y
    branches/ruby_2_2/test/ruby/test_literal.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 52772)
+++ ruby_2_2/ChangeLog	(revision 52773)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Sat Nov 28 06:28:55 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]
+
 Sat Nov 28 06:12:32 2015  NARUSE, Yui  <naruse@r...>
 
 	* ext/openssl/ossl_ssl.c (ssl_npn_select_cb): explicitly raise error
Index: ruby_2_2/parse.y
===================================================================
--- ruby_2_2/parse.y	(revision 52772)
+++ ruby_2_2/parse.y	(revision 52773)
@@ -8744,7 +8744,7 @@ literal_concat_gen(struct parser_params https://github.com/ruby/ruby/blob/trunk/ruby_2_2/parse.y#L8744
 
     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;
     }
@@ -8817,7 +8817,7 @@ static NODE * https://github.com/ruby/ruby/blob/trunk/ruby_2_2/parse.y#L8817
 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_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 52772)
+++ ruby_2_2/version.h	(revision 52773)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.4"
 #define RUBY_RELEASE_DATE "2015-11-28"
-#define RUBY_PATCHLEVEL 205
+#define RUBY_PATCHLEVEL 206
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 11
Index: ruby_2_2/test/ruby/test_literal.rb
===================================================================
--- ruby_2_2/test/ruby/test_literal.rb	(revision 52772)
+++ ruby_2_2/test/ruby/test_literal.rb	(revision 52773)
@@ -102,6 +102,15 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_literal.rb#L102
     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_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51820


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

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