def begin_body(compound_stmt, rescue_bodies=[],
else_t=nil, else_=nil,
ensure_t=nil, ensure_=nil)
if rescue_bodies.any?
if else_t
compound_stmt =
n(:rescue,
[ compound_stmt, *(rescue_bodies + [ else_ ]) ],
eh_keyword_map(compound_stmt, nil, rescue_bodies, else_t, else_))
else
compound_stmt =
n(:rescue,
[ compound_stmt, *(rescue_bodies + [ nil ]) ],
eh_keyword_map(compound_stmt, nil, rescue_bodies, nil, nil))
end
elsif else_t
statements = []
if !compound_stmt.nil?
if compound_stmt.type == :begin
statements += compound_stmt.children
else
statements.push(compound_stmt)
end
end
statements.push(
n(:begin, [ else_ ],
collection_map(else_t, [ else_ ], nil)))
compound_stmt =
n(:begin, statements,
collection_map(nil, statements, nil))
end
if ensure_t
compound_stmt =
n(:ensure,
[ compound_stmt, ensure_ ],
eh_keyword_map(compound_stmt, ensure_t, [ ensure_ ], nil, nil))
end
compound_stmt
end