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

ruby-changes:36554

From: usa <ko1@a...>
Date: Fri, 28 Nov 2014 16:37:37 +0900 (JST)
Subject: [ruby-changes:36554] usa:r48635 (ruby_2_0_0): merge revision(s) 48484: [Backport #10524]

usa	2014-11-28 16:37:22 +0900 (Fri, 28 Nov 2014)

  New Revision: 48635

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

  Log:
    merge revision(s) 48484: [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_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/parse.y
    branches/ruby_2_0_0/test/ruby/test_literal.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 48634)
+++ ruby_2_0_0/ChangeLog	(revision 48635)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Nov 28 16:36:34 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (symbol_list): fix the node type of literal symbol list
+	  with no interpolation.  [ruby-core:66343]
+
 Fri Nov 28 16:28:07 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/etc/etc.c (etc_getlogin): set login name encoding properly.
Index: ruby_2_0_0/parse.y
===================================================================
--- ruby_2_0_0/parse.y	(revision 48634)
+++ ruby_2_0_0/parse.y	(revision 48635)
@@ -4043,7 +4043,13 @@ symbol_list	: /* none */ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/parse.y#L4043
 		    {
 		    /*%%%*/
 			$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_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 48634)
+++ ruby_2_0_0/version.h	(revision 48635)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-11-28"
-#define RUBY_PATCHLEVEL 604
+#define RUBY_PATCHLEVEL 605
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 11
Index: ruby_2_0_0/test/ruby/test_literal.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_literal.rb	(revision 48634)
+++ ruby_2_0_0/test/ruby/test_literal.rb	(revision 48635)
@@ -434,4 +434,14 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/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_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r48484


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

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