broken output for function with exceptions
eqv opened this issue · 1 comments
eqv commented
the following function
def check
begin
foo
rescue
bar
bar
end
bar
if foo
return bar
else
bar
end
end
gets parsed to to this sexpr:
s(:defn,
:check,
s(:args),
s(:rescue,
s(:call, nil, :foo),
s(:resbody, s(:array), s(:call, nil, :bar), s(:call, nil, :bar))),
s(:call, nil, :bar),
s(:if,
s(:call, nil, :foo),
s(:return, s(:call, nil, :bar)),
s(:call, nil, :bar)))
and will be printed as:
def check
foo
rescue
bar
bar
end
bar
if foo then
return bar
else
bar
end
Which has mismatching begins/ends. Any further minimization fails to produce the same error. I believe there is a problem where the begin is omitted if the checked code has just one statement. It should also be added if the rescue code has more than one statement.
zenspider commented
Fixed. Thanks!