rewrite_bmethod (UnifiedRuby)

    # File lib/unified_ruby.rb, line 11
      def rewrite_bmethod(exp)
        exp[0] = :scope

        args =
          if exp.masgn and exp.masgn.dasgn_curr then
            arg = exp.masgn(true).dasgn_curr(true).sexp_body
            raise "nope: #{arg.size}" unless arg.size == 1
            s(:args, "*#{arg.last}""*#{arg.last}")
          else
            args = exp.dasgn_curr(true)
            if args then
              s(:args, *args.sexp_body)
            else
              exp.delete_at 1 # nil
              s(:args)
            end
          end

        exp = s(:scope, s(:block, *exp.sexp_body)) unless exp.block
        exp.block.insert 1, args
        exp.find_and_replace_all(:dvar, :lvar)

        exp
      end