         (println "(function() {")
         (println (str "var " name " = null;"))
         (doseq [[n meth] ms]
-          (println (str "var " n " = " (with-out-str (if variadic
+          (println (str "var " n " = " (with-out-str (if (:variadic meth)
                                                        (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 "})")))

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

    (when-not (= :expr (:context env)) (print ";\n"))
    (when export
      (println (str "goog.exportSymbol('" export "', " name ");")))))

(defn emit-apply-to
  [{:keys [name params env]}]
