1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2011-07-06 19:31:33 +00:00
parent ca252765bc
commit c1d84bfcdb
3 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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 '}'

View file

@ -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