fix throw-illegal in cljs code
This commit is contained in:
parent
c65b31181a
commit
8764a4b2b6
2 changed files with 9 additions and 5 deletions
|
|
@ -31,7 +31,7 @@
|
||||||
:profiles {:dev {:dependencies
|
:profiles {:dev {:dependencies
|
||||||
[[org.clojure/test.check "0.9.0"]
|
[[org.clojure/test.check "0.9.0"]
|
||||||
[org.clojure/clojure "1.9.0"]
|
[org.clojure/clojure "1.9.0"]
|
||||||
[org.clojure/clojurescript "1.10.126"]]}
|
[org.clojure/clojurescript "1.10.439"]]}
|
||||||
|
|
||||||
:test {:dependencies [[org.clojure/clojure "1.7.0"]]}}
|
:test {:dependencies [[org.clojure/clojure "1.7.0"]]}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
(ns com.rpl.specter.impl
|
(ns com.rpl.specter.impl
|
||||||
#?(:cljs (:require-macros
|
#?(:cljs (:require-macros
|
||||||
[com.rpl.specter.util-macros
|
[com.rpl.specter.util-macros
|
||||||
:refer [doseqres mk-comp-navs mk-late-fn mk-late-fn-records]]))
|
:refer [doseqres mk-comp-navs mk-late-fn mk-late-fn-records]]
|
||||||
|
[com.rpl.specter.impl :refer [throw-illegal]]))
|
||||||
;; workaround for cljs bug that emits warnings for vars named the same as a
|
;; workaround for cljs bug that emits warnings for vars named the same as a
|
||||||
;; private var in cljs.core (in this case `NONE`, added as private var to
|
;; private var in cljs.core (in this case `NONE`, added as private var to
|
||||||
;; cljs.core with 1.9.562)
|
;; cljs.core with 1.9.562)
|
||||||
|
|
@ -56,11 +57,14 @@
|
||||||
#?(
|
#?(
|
||||||
:clj
|
:clj
|
||||||
(defmacro throw-illegal [& args]
|
(defmacro throw-illegal [& args]
|
||||||
`(throw* IllegalArgumentException ~@args))
|
(let [platform (if (contains? &env :locals) :cljs :clj)]
|
||||||
|
(if (= platform :clj)
|
||||||
|
`(throw* IllegalArgumentException ~@args)
|
||||||
|
`(com.rpl.specter.impl/throw-illegal* ~@args)
|
||||||
|
)))
|
||||||
|
|
||||||
:cljs
|
:cljs
|
||||||
(defn throw-illegal [& args]
|
(defn throw-illegal* [& args]
|
||||||
(throw (js/Error. (apply str args)))))
|
(throw (js/Error. (apply str args)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue