class Rufo::Formatter
def visit_exps(exps, with_indent = false, with_lines = true)
def visit_exps(exps, with_indent = false, with_lines = true) consume_end_of_line(true) line_before_endline = nil exps.each_with_index do |exp, i| exp_kind = exp[0] # Skip voids to avoid extra indentation if exp_kind == :void_stmt next end if with_indent # Don't indent if this exp is in the same line as the previous # one (this happens when there's a semicolon between the exps) unless line_before_endline && line_before_endline == @line write_indent end end visit exp line_before_endline = @line is_last = last?(i, exps) if with_lines consume_end_of_line(false, !is_last, !is_last) # Make sure to put two lines before defs, class and others if !is_last && (needs_two_lines?(exp_kind) || needs_two_lines?(exps[i + 1][0])) && @line <= line_before_endline + 1 write_line end else skip_space_or_newline unless is_last end end end