Skip to content

Commit 1c2094c

Browse files
committed
add public with-warning-handlers
1 parent 8db5b76 commit 1c2094c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@
6161
[warning-type env extra]
6262
(ana/default-warning-handler warning-type env extra))
6363

64+
(defmacro with-warning-handlers
65+
"Helper macro for custom handling of emitted warnings. Handlers should be
66+
a vector of functions. The signature of these functions is
67+
[warn-type env warn-info]. warn-type is a keyword describing the warning,
68+
env is the analysis environment, and warn-info is a map of extra useful
69+
information for a particular warning type."
70+
[handlers & body]
71+
`(ana/with-warning-handlers ~handlers
72+
~@body))
73+
6474
(defn get-options
6575
"Return the compiler options from compiler state."
6676
([] (get-options (current-state)))

0 commit comments

Comments
 (0)