mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 02:46:45 +00:00
- Added to CI now that it passes - Added no-doc for docstrings that don't add any more than what's in the ns name or for ones where I didn't know the ns that well
28 lines
1022 B
Clojure
28 lines
1022 B
Clojure
(ns frontend.debug
|
|
"Macros that are useful for debugging"
|
|
(:refer-clojure :rename {defn core-defn}))
|
|
|
|
(defmacro defn [name & fdecl]
|
|
(let [fdecl (if (string? (first fdecl))
|
|
(next fdecl)
|
|
fdecl)
|
|
fdecl (if (map? (first fdecl))
|
|
(next fdecl)
|
|
fdecl)
|
|
fdecl (if (vector? (first fdecl))
|
|
(list fdecl)
|
|
fdecl)
|
|
fdecl (if (map? (last fdecl))
|
|
(butlast fdecl)
|
|
fdecl)
|
|
fdecl (map (fn [decl]
|
|
(let [params (first decl)
|
|
body (next decl)]
|
|
`(~params
|
|
(let [start# (cljs.core/system-time)
|
|
ret# (do ~@body)
|
|
elapsed# (.toFixed (- (cljs.core/system-time) start#) 6)]
|
|
(println (str "[" '~name "] " elapsed# " msecs"))
|
|
ret#)))) fdecl)]
|
|
`(core-defn ~@(cons name fdecl))))
|