seattlerb/ruby2ruby — pull request #22 by Bocete (2013-09-04 02:48:02+00:00)
Title: Parenthesis around rescue statement modifiers

Hi,

MRI cannot parse [a rescue b], but can parse semantically equivalent [(a rescue b)]. For the following sexp:

s(:array,
s(:rescue, s(:call, nil, :a), s(:resbody, s(:array), s(:call, nil, :b))))
Ruby2ruby returns
[a rescue b]
which is unparseable.

A similar issue can be recreated with method((a rescue b)) which is legal, but for the sexp

s(:call,
nil,
:method,
s(:rescue, s(:lit, 1), s(:resbody, s(:array), s(:lit, 2))))
Ruby2Ruby outputs method(a rescue b) which is unparseable by MRI.

The fix will add parenthesis around rescue arguments. Two tests included.

Note that this suggested fix does not pass one test from `sexp_processor`. This one test is *wrong* and I'll proceed to create a pull request that fixes the test