diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-06 19:31:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-06 19:31:33 +0000 |
commit | c1d84bfcdb113364f9fcdef94a07961613743ff3 (patch) | |
tree | 93316d146bfaf6e1c507dc391858aab274ca8a82 | |
parent | ca252765bcfd1b05189a73e366d361d4eefbd988 (diff) | |
download | ruby-c1d84bfcdb113364f9fcdef94a07961613743ff3.tar.gz |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/ripper/test_parser_events.rb | 8 |
3 files changed, 13 insertions, 3 deletions
@@ -1,3 +1,9 @@ +Thu Jul 7 04:31:26 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> * win32/win32.c (kill): check that the process exited or not before @@ -1045,7 +1045,7 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem 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 '}' diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 9f97dbae20..14799d39e7 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -777,14 +777,18 @@ class TestRipper::ParserEvents < Test::Unit::TestCase 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 |