Skip to content

Commit 2f8dd2e

Browse files
committed
add public functions for getting the current-ns & the current-file, add missing
docstrings
1 parent 419cd4b commit 2f8dd2e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/main/clojure/cljs/analyzer/api.cljc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,21 @@
2828
([opts]
2929
(env/default-compiler-env opts)))
3030

31-
(defn current-state []
31+
(defn current-state
32+
"Return the current compiler state atom."
33+
[]
3234
env/*compiler*)
3335

36+
(defn current-file
37+
"Return the current file under analysis or compilation."
38+
[]
39+
ana/*cljs-file*)
40+
41+
(defn current-ns
42+
"Return the current ns under analysis or compilation."
43+
[]
44+
ana/*cljs-ns*)
45+
3446
(defmacro with-state
3547
"Run the body with the given compilation state Atom<Map>."
3648
[state & body]
@@ -95,9 +107,13 @@
95107
([state]
96108
(get @state :js-dependency-index)))
97109

98-
(def default-passes ana/default-passes)
110+
(def
111+
^{:doc "ClojureScript's default analysis passes."}
112+
default-passes ana/default-passes)
99113

100-
(defmacro with-passes [passes & body]
114+
(defmacro with-passes
115+
"Evaluate the body with the provided sequence of compiler passes."
116+
[passes & body]
101117
`(binding [ana/*passes* ~passes]
102118
~@body))
103119

0 commit comments

Comments
 (0)