         (if variadic
           (emit-variadic-fn-method (assoc (first methods) :name name))
           (emit-fn-method (assoc (first methods) :name name)))
-        (let [name (or name (gensym))
+        (let [has-name? (and name true)
+              name (or name (gensym))
               maxparams (apply max-key count (map :params methods))
               mmap (into {}
                      (map (fn [method]

                (let [arities (map #(-> % :params count) methods)]
                  (if (some #{arity} arities)
                    (update-in f [:info :name]
                      (fn [name] (symbol (str name "__" arity))))
                    f))))
            f)]
    (emit-wrap env

          (doseq [[n meth] ms]
            (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
                                                         (concat (butlast maxparams) ['var_args])
                                                         maxparams)) "){"))
