summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--parse.y2
-rw-r--r--test/ripper/test_parser_events.rb8
3 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 49f6ce24ac..931510ae48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/parse.y b/parse.y
index f1663ef21f..015ad51531 100644
--- a/parse.y
+++ b/parse.y
@@ -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