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

ruby-changes:37287

From: nagachika <ko1@a...>
Date: Thu, 22 Jan 2015 00:59:21 +0900 (JST)
Subject: [ruby-changes:37287] nagachika:r49368 (ruby_2_1): merge revision(s) r48484: [Backport #10524]

nagachika	2015-01-22 00:59:11 +0900 (Thu, 22 Jan 2015)

  New Revision: 49368

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

  Log:
    merge revision(s) r48484: [Backport #10524]
    
    * parse.y (symbol_list): fix the node type of literal symbol list
      with no interpolation.  [ruby-core:66343]

  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 49367)
+++ ruby_2_1/ChangeLog	(revision 49368)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Thu Jan 22 00:54:00 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (symbol_list): fix the node type of literal symbol list
+	  with no interpolation.  [ruby-core:66343]
+
 Thu Jan 22 00:49:52 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* object.c: [DOC] Revise documentation by Marcus Stollsteimer at
Index: ruby_2_1/parse.y
===================================================================
--- ruby_2_1/parse.y	(revision 49367)
+++ ruby_2_1/parse.y	(revision 49368)
@@ -4033,7 +4033,13 @@ symbol_list	: /* none */ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/parse.y#L4033
 		    {
 		    /*%%%*/
 			$2 = evstr2dstr($2);
-			nd_set_type($2, NODE_DSYM);
+			if (nd_type($2) == NODE_DSTR) {
+			    nd_set_type($2, NODE_DSYM);
+			}
+			else {
+			    nd_set_type($2, NODE_LIT);
+			    $2->nd_lit = rb_str_intern($2->nd_lit);
+			}
 			$$ = list_append($1, $2);
 		    /*%
 			$$ = dispatch2(symbols_add, $1, $2);
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 49367)
+++ ruby_2_1/version.h	(revision 49368)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.5"
 #define RUBY_RELEASE_DATE "2015-01-22"
-#define RUBY_PATCHLEVEL 281
+#define RUBY_PATCHLEVEL 282
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_1/test/ruby/test_literal.rb
===================================================================
--- ruby_2_1/test/ruby/test_literal.rb	(revision 49367)
+++ ruby_2_1/test/ruby/test_literal.rb	(revision 49368)
@@ -434,4 +434,14 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_literal.rb#L434
     }
   end
 
+  def test_symbol_list
+    assert_equal([:foo, :bar], %i[foo bar])
+    assert_equal([:"\"foo"], %i["foo])
+
+    x = 10
+    assert_equal([:foo, :b10], %I[foo b#{x}])
+    assert_equal([:"\"foo10"], %I["foo#{x}])
+
+    assert_ruby_status(["--disable-gems", "--dump=parsetree"], "%I[foo bar]")
+  end
 end

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


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

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