 (defmethod emit :def
   [{:keys [name init env]}]
   (when init
+    (when (:jsdoc init)
+      (println "/**")
+      (doseq [e (:jsdoc init)]
+        (when e
+          (println "*" e)))
+      (println "*/"))
     (print name)
     (print (str " = " (emits init)))
     (when-not (= :expr (:context env)) (print ";\n"))))

        locals (if name (assoc locals name {:name mname}) locals)
        menv (if (> (count meths) 1) (assoc env :context :expr) env)
        methods (map #(analyze-fn-method menv locals %) meths)
        max-fixed-arity (apply max (map :fixed-arity methods))]
    ;;(assert (= 1 (count methods)) "Arity overloading not yet supported")
    ;;todo - validate unique arities, at most one variadic, variadic takes max required args
    {:env env :op :fn :name mname :methods methods :variadic (some :variadic methods) :max-fixed-arity max-fixed-arity}))

(defmethod parse 'do
  [op env [_ & exprs] _]

        (println (str "var " name " = null;"))
        (doseq [[n meth] ms]
          (println (str "var " n " = " (with-out-str (emit-fn-method meth)) ";")))
        (println (str name " = function(" (comma-sep (if variadic
                                                       (concat (butlast maxparams) ['var_args])
                                                       maxparams)) "){"))
        (when variadic
          (println (str "var " (last maxparams) " = var_args;")))
        (println "switch(arguments.length){")
        (doseq [[n meth] ms]
          (if (:variadic meth)
