process_case (Rewriter)

    # File lib/rewriter.rb, line 61
      def process_case(exp)
        result = s()
        var = process exp.shift
        else_stmt = process exp.pop

        new_exp = result

        until exp.empty? do
          c = exp.shift
          # start a new scope and move to it
          new_exp << s(:if)
          new_exp = new_exp.last

          assert_type c, :when
          ignored_type, vars, stmts = process(c)

          vars = vars.map { |v| s(:call,
                                  var.deep_clone,
                                  :===,
                                  s(:arglist, process(v)))}
          if vars.size > 1 then

            # building from the bottom up, so everything is bizarro-sexp
            # BIZARRO-SEXP NO LIKE OR!
            or_sexp = vars.inject(s(:or, *vars.slice!(-2,2))) do |lhs, rhs|
              s(:or, rhs, lhs)
            end

            new_exp << or_sexp
          else
            new_exp << vars.first
          end
          new_exp << stmts
        end
        new_exp << else_stmt

        result.first
      end