Skip to content

Commit

Permalink
Fix cljs compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
niwinz committed Dec 4, 2023
1 parent 6fd2621 commit a7a2666
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/promesa/util.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,29 @@
([o reason]
(pt/-close! o reason)))

(extend-protocol pt/ICloseable
java.util.concurrent.ExecutorService
(-closed? [it]
(.isShutdown it))
(-close! [it]
(.close it))

java.lang.AutoCloseable
(-closed? [_]
(throw (IllegalArgumentException. "not implemented")))
(-close! [it]
(.close ^java.lang.AutoCloseable it)))
#?(:clj
(extend-protocol pt/ICloseable
java.util.concurrent.ExecutorService
(-closed? [it]
(.isShutdown it))
(-close! [it]
(.close it))

java.lang.AutoCloseable
(-closed? [_]
(throw (IllegalArgumentException. "not implemented")))
(-close! [it]
(.close ^java.lang.AutoCloseable it))))

(defmacro with-open
[bindings & body]
{:pre [(vector? bindings)
(even? (count bindings))
(pos? (count bindings))]}

(when (:ns &env)
(throw (ex-info "cljs not supported on with-dispatch! macro" {})))

(reduce (fn [acc bindings]
`(let ~(vec bindings)
(try
Expand Down

0 comments on commit a7a2666

Please sign in to comment.