     (when-not (= :expr (:context env)) (print ";\n"))
     (when export
       (println (str "goog.exportSymbol('" export "', " name ");")))))
-
-(defn emit-fn-method
-  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
-  (emit-wrap env
-             (print (str "(function " name "(" (comma-sep params) "){\n"))
-             (when gthis
-               (println (str "var " gthis " = this;")))
-             (when recurs (print "while(true){\n"))
-             (emit-block :return statements ret)
-             (when recurs (print "break;\n}\n"))
-             (print "})")))
-
-(defn emit-variadic-fn-method
-  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
-  (emit-wrap env
-             (print (str "(function " name "(" (comma-sep
-                                                (if variadic
-                                                  (concat (butlast params) ['var_args])
-                                                  params)) "){\n"))
-             (when gthis
-               (println (str "var " gthis " = this;")))
-             (when variadic
-               (println (str "var " (last params) " = cljs.core.array_seq(Array.prototype.slice.call(arguments, " (dec (count params)) "),0);"))
-               #_(println (str (last params) " = Array.prototype.slice.call(arguments, " (dec (count params)) ");")))
-             (when recurs (print "while(true){\n"))
-             (emit-block :return statements ret)
-             (when recurs (print "break;\n}\n"))
-             (print "})")))
 
 (defn emit-apply-to
   [{:keys [name params env]}]

        (println "(function() {")
        (println (str "var " name " = null;"))
        (doseq [[n meth] ms]
          (println (str "var " n " = " (with-out-str (if variadic
                                                       (emit-variadic-fn-method meth)
                                                       (emit-fn-method meth))) ";")))
        (println (str name " = function(" (comma-sep (if variadic

    (println (str "return " name ".call(" (string/join ", " (cons "null" params)) ");"))
    (print "})")))

(defn emit-fn-method
  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
  (emit-wrap env
             (print (str "(function " name "(" (comma-sep params) "){\n"))
             (when gthis
               (println (str "var " gthis " = this;")))
             (when recurs (print "while(true){\n"))
             (emit-block :return statements ret)
             (when recurs (print "break;\n}\n"))
             (print "})")))

(defn emit-variadic-fn-method
  [{:keys [gthis name variadic params statements ret env recurs max-fixed-arity]}]
  (emit-wrap env
             (print (str "(function " name "(" (comma-sep
                                                (if variadic
                                                  (concat (butlast params) ['var_args])
                                                  params)) "){\n"))
             (when gthis
               (println (str "var " gthis " = this;")))
             (when variadic
               (println (str "var " (last params) " = cljs.core.array_seq(Array.prototype.slice.call(arguments, " (dec (count params)) "),0);"))
               #_(println (str (last params) " = Array.prototype.slice.call(arguments, " (dec (count params)) ");")))
             (when recurs (print "while(true){\n"))
             (emit-block :return statements ret)
             (when recurs (print "break;\n}\n"))
             (print "})")))

(defmethod emit :fn
  [{:keys [name env methods max-fixed-arity variadic]}]
  ;;fn statements get erased, serve no purpose and can pollute scope if named
