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

ruby-changes:33848

From: nagachika <ko1@a...>
Date: Mon, 12 May 2014 23:04:33 +0900 (JST)
Subject: [ruby-changes:33848] nagachika:r45929 (ruby_2_1): merge revision(s) r45637: [Backport #9726]

nagachika	2014-05-12 23:04:24 +0900 (Mon, 12 May 2014)

  New Revision: 45929

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

  Log:
    merge revision(s) r45637: [Backport #9726]
    
    * parse.y (primary): flush cmdarg flags inside left-paren in a
      command argument, to allow parenthesed do-block as an argument
      without arguments parentheses.  [ruby-core:61950] [Bug #9726]

  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_syntax.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 45928)
+++ ruby_2_1/ChangeLog	(revision 45929)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon May 12 22:53:08 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (primary): flush cmdarg flags inside left-paren in a
+	  command argument, to allow parenthesed do-block as an argument
+	  without arguments parentheses.  [ruby-core:61950] [Bug #9726]
+
 Mon May 12 22:22:43 2014  Koichi Sasada  <ko1@a...>
 
 	* vm.c (invoke_block_from_c): add VM_FRAME_FLAG_BMETHOD to record
Index: ruby_2_1/parse.y
===================================================================
--- ruby_2_1/parse.y	(revision 45928)
+++ ruby_2_1/parse.y	(revision 45929)
@@ -2612,12 +2612,18 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/ruby_2_1/parse.y#L2612
 			$$ = dispatch1(paren, 0);
 		    %*/
 		    }
-		| tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} rparen
+		| tLPAREN_ARG
 		    {
+			$<val>1 = cmdarg_stack;
+			cmdarg_stack = 0;
+		    }
+		  expr {lex_state = EXPR_ENDARG;} rparen
+		    {
+			cmdarg_stack = $<val>1;
 		    /*%%%*/
-			$$ = $2;
+			$$ = $3;
 		    /*%
-			$$ = dispatch1(paren, $2);
+			$$ = dispatch1(paren, $3);
 		    %*/
 		    }
 		| tLPAREN compstmt ')'
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 45928)
+++ ruby_2_1/version.h	(revision 45929)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.2"
 #define RUBY_RELEASE_DATE "2014-05-12"
-#define RUBY_PATCHLEVEL 99
+#define RUBY_PATCHLEVEL 100
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 5
Index: ruby_2_1/test/ruby/test_syntax.rb
===================================================================
--- ruby_2_1/test/ruby/test_syntax.rb	(revision 45928)
+++ ruby_2_1/test/ruby/test_syntax.rb	(revision 45929)
@@ -78,6 +78,11 @@ class TestSyntax < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_syntax.rb#L78
     end
   end
 
+  def test_do_block_in_cmdarg
+    bug9726 = '[ruby-core:61950] [Bug #9726]'
+    assert_valid_syntax("tap (proc do end)", __FILE__, bug9726)
+  end
+
   def test_keyword_rest
     bug5989 = '[ruby-core:42455]'
     assert_valid_syntax("def kwrest_test(**a) a; end", __FILE__, bug5989)

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


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

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