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

ruby-changes:34428

From: usa <ko1@a...>
Date: Mon, 23 Jun 2014 17:00:19 +0900 (JST)
Subject: [ruby-changes:34428] usa:r46509 (ruby_2_0_0): merge revision(s) 45637: [Backport #9726]

usa	2014-06-23 17:00:08 +0900 (Mon, 23 Jun 2014)

  New Revision: 46509

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

  Log:
    merge revision(s) 45637: [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_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_syntax.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 46508)
+++ ruby_2_0_0/ChangeLog	(revision 46509)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Mon Jun 23 16:55:13 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 Jun 23 16:45:48 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/dl/cptr.c (dlptr_free), ext/dl/handle.c (dlhandle_free),
Index: ruby_2_0_0/parse.y
===================================================================
--- ruby_2_0_0/parse.y	(revision 46508)
+++ ruby_2_0_0/parse.y	(revision 46509)
@@ -2621,12 +2621,18 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/parse.y#L2621
 			$$ = 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_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 46508)
+++ ruby_2_0_0/version.h	(revision 46509)
@@ -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-06-23"
-#define RUBY_PATCHLEVEL 491
+#define RUBY_PATCHLEVEL 492
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_0_0/test/ruby/test_syntax.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_syntax.rb	(revision 46508)
+++ ruby_2_0_0/test/ruby/test_syntax.rb	(revision 46509)
@@ -78,6 +78,11 @@ class TestSyntax < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/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_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45637


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

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