(defn var-meta
([var]
(var-meta var nil))
([var expr-env]
(let [sym (:name var)
ks [:ns :doc :file :line :column]
m (merge
(let [user-meta (:meta var)
uks (keys user-meta)]
(zipmap uks
(map #(list 'quote (get user-meta %)) uks)))
(assoc (zipmap ks (map #(list 'quote (get var %)) ks))
:name `(quote ~(symbol (name (:name var))))
:test `(when ~sym (.-cljs$lang$test ~sym))
:arglists (let [arglists (:arglists var)
arglists' (if (= 'quote (first arglists))
(second arglists)
arglists)]
(list 'quote
(doall (map with-meta arglists'
(:arglists-meta var)))))))]
(if expr-env
(analyze expr-env m)
m))))