ruby-changes:43892
From: nobu <ko1@a...>
Date: Fri, 19 Aug 2016 11:39:15 +0900 (JST)
Subject: [ruby-changes:43892] nobu:r55965 (trunk): parse.y: lparen_arg statement
nobu 2016-08-19 11:39:09 +0900 (Fri, 19 Aug 2016) New Revision: 55965 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55965 Log: parse.y: lparen_arg statement * parse.y (primary): allow parenthesised statement as a method argument. [Feature #12686] Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ruby/test_syntax.rb Index: parse.y =================================================================== --- parse.y (revision 55964) +++ parse.y (revision 55965) @@ -2659,7 +2659,7 @@ primary : literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2659 $<val>1 = cmdarg_stack; CMDARG_SET(0); } - expr {SET_LEX_STATE(EXPR_ENDARG);} rparen + stmt {SET_LEX_STATE(EXPR_ENDARG);} rparen { CMDARG_SET($<val>1); /*%%%*/ Index: test/ruby/test_syntax.rb =================================================================== --- test/ruby/test_syntax.rb (revision 55964) +++ test/ruby/test_syntax.rb (revision 55965) @@ -827,6 +827,11 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L827 end end + def test_parenthesised_statement_argument + assert_syntax_error("foo(bar rescue nil)", /unexpected modifier_rescue/) + assert_valid_syntax("foo (bar rescue nil)") + end + private def not_label(x) @result = x; @not_label ||= nil end Index: ChangeLog =================================================================== --- ChangeLog (revision 55964) +++ ChangeLog (revision 55965) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Aug 19 11:39:06 2016 Nobuyoshi Nakada <nobu@r...> + + * parse.y (primary): allow parenthesised statement as a method + argument. [Feature #12686] + Fri Aug 19 09:12:45 2016 Nobuyoshi Nakada <nobu@r...> * vm.c (vm_set_main_stack): TOPLEVEL_BINDING must be built. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/