ruby-changes:20380
From: nobu <ko1@a...>
Date: Thu, 7 Jul 2011 04:31:42 +0900 (JST)
Subject: [ruby-changes:20380] nobu:r32428 (trunk): * parse.y (arg): rescue_mod is in inverse order from other
nobu 2011-07-07 04:31:33 +0900 (Thu, 07 Jul 2011) New Revision: 32428 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32428 Log: * parse.y (arg): rescue_mod is in inverse order from other modifiers. patched by michael.j.edgar AT dartmouth.edu at [ruby-core:36248]. fixed #4716. Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ripper/test_parser_events.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 32427) +++ ChangeLog (revision 32428) @@ -1,3 +1,9 @@ +Thu Jul 7 04:31:26 2011 Nobuyoshi Nakada <nobu@r...> + + * parse.y (arg): rescue_mod is in inverse order from other + modifiers. patched by michael.j.edgar AT dartmouth.edu at + [ruby-core:36248]. fixed #4716. + Thu Jul 7 00:40:16 2011 NAKAMURA Usaku <usa@r...> * win32/win32.c (kill): check that the process exited or not before Index: parse.y =================================================================== --- parse.y (revision 32427) +++ parse.y (revision 32428) @@ -1045,7 +1045,7 @@ NODE *resq = NEW_RESBODY(0, remove_begin($3), 0); $$ = NEW_RESCUE(remove_begin($1), resq, 0); /*% - $$ = dispatch2(rescue_mod, $3, $1); + $$ = dispatch2(rescue_mod, $1, $3); %*/ } | keyword_END '{' compstmt '}' Index: test/ripper/test_parser_events.rb =================================================================== --- test/ripper/test_parser_events.rb (revision 32427) +++ test/ripper/test_parser_events.rb (revision 32428) @@ -777,14 +777,18 @@ def test_rescue thru_rescue = false - parse('begin; rescue; end', :on_rescue) {thru_rescue = true} + parsed = parse('begin; 1; rescue => e; 2; end', :on_rescue) {thru_rescue = true} assert_equal true, thru_rescue + assert_match /1.*rescue/, parsed + assert_match /rescue\(,var_field\(e\),\[2\]\)/, parsed end def test_rescue_mod thru_rescue_mod = false - parse('nil rescue nil', :on_rescue_mod) {thru_rescue_mod = true} + parsed = parse('1 rescue 2', :on_rescue_mod) {thru_rescue_mod = true} assert_equal true, thru_rescue_mod + bug4716 = '[ruby-core:36248]' + assert_equal "[rescue_mod(1,2)]", parsed, bug4716 end def test_rest_param -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/