ruby-changes:37059
From: nobu <ko1@a...>
Date: Sun, 4 Jan 2015 21:33:10 +0900 (JST)
Subject: [ruby-changes:37059] nobu:r49140 (trunk): parse.y: fix f_label result
nobu 2015-01-04 21:32:54 +0900 (Sun, 04 Jan 2015) New Revision: 49140 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49140 Log: parse.y: fix f_label result * parse.y (f_label): return tLABEL value as it is. [ruby-core:67315] [Bug #10693] Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ripper/test_parser_events.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 49139) +++ ChangeLog (revision 49140) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Jan 4 21:32:52 2015 Nobuyoshi Nakada <nobu@r...> + + * parse.y (f_label): return tLABEL value as it is. + [ruby-core:67315] [Bug #10693] + Sun Jan 4 14:02:37 2015 Nobuyoshi Nakada <nobu@r...> * test/lib/test/unit/parallel.rb (run): expand the file name to be Index: parse.y =================================================================== --- parse.y (revision 49139) +++ parse.y (revision 49140) @@ -4729,9 +4729,9 @@ f_arg : f_arg_item https://github.com/ruby/ruby/blob/trunk/parse.y#L4729 f_label : tLABEL { ID id = get_id($1); - $$ = formal_argument(id); - arg_var($$); + arg_var(formal_argument(id)); current_arg = id; + $$ = $1; } ; Index: test/ripper/test_parser_events.rb =================================================================== --- test/ripper/test_parser_events.rb (revision 49139) +++ test/ripper/test_parser_events.rb (revision 49140) @@ -751,15 +751,31 @@ class TestRipper::ParserEvents < Test::U https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L751 end def test_params + arg = nil thru_params = false - parse('a {||}', :on_params) {thru_params = true} + parse('a {||}', :on_params) {|_, *v| thru_params = true; arg = v} assert_equal true, thru_params + assert_equal [nil, nil, nil, nil, nil, nil, nil], arg thru_params = false - parse('a {|x|}', :on_params) {thru_params = true} + parse('a {|x|}', :on_params) {|_, *v| thru_params = true; arg = v} assert_equal true, thru_params + assert_equal [["x"], nil, nil, nil, nil, nil, nil], arg thru_params = false - parse('a {|*x|}', :on_params) {thru_params = true} + parse('a {|*x|}', :on_params) {|_, *v| thru_params = true; arg = v} assert_equal true, thru_params + assert_equal [nil, nil, "*x", nil, nil, nil, nil], arg + thru_params = false + parse('a {|x: 1|}', :on_params) {|_, *v| thru_params = true; arg = v} + assert_equal true, thru_params + assert_equal [nil, nil, nil, nil, [["x:", "1"]], nil, nil], arg + thru_params = false + parse('a {|x:|}', :on_params) {|_, *v| thru_params = true; arg = v} + assert_equal true, thru_params + assert_equal [nil, nil, nil, nil, [["x:", false]], nil, nil], arg + thru_params = false + parse('a {|**x|}', :on_params) {|_, *v| thru_params = true; arg = v} + assert_equal true, thru_params + assert_equal [nil, nil, nil, nil, nil, "x", nil], arg end def test_paren -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/