Minor tweak: avoid top-level dos.

This commit is contained in:
Josh Tilles 2015-10-09 14:58:59 -04:00
parent 9e215b638e
commit 8df05c2597

View file

@ -22,12 +22,12 @@
(comp-paths* [paths])) (comp-paths* [paths]))
#+clj #+clj
(do
(defmacro throw* [etype & args] (defmacro throw* [etype & args]
`(throw (new ~etype (pr-str ~@args)))) `(throw (new ~etype (pr-str ~@args))))
#+clj
(defmacro throw-illegal [& args] (defmacro throw-illegal [& args]
`(throw* IllegalArgumentException ~@args))) `(throw* IllegalArgumentException ~@args))
#+cljs #+cljs
@ -132,29 +132,27 @@
))) )))
#+clj #+clj
(do
(defn structure-path-impl [this] (defn structure-path-impl [this]
(if (fn? this) (if (fn? this)
;;TODO: this isn't kosher, it uses knowledge of internals of protocols ;;TODO: this isn't kosher, it uses knowledge of internals of protocols
(-> p/StructurePath :impls (get clojure.lang.AFn)) (-> p/StructurePath :impls (get clojure.lang.AFn))
(find-protocol-impl! p/StructurePath this))) (find-protocol-impl! p/StructurePath this)))
#+clj
(defn collector-impl [this] (defn collector-impl [this]
(find-protocol-impl! p/Collector this)) (find-protocol-impl! p/Collector this))
)
#+cljs #+cljs
(do
(defn structure-path-impl [obj] (defn structure-path-impl [obj]
{:select* (mk-optimized-invocation p/StructurePath obj select* 2) {:select* (mk-optimized-invocation p/StructurePath obj select* 2)
:transform* (mk-optimized-invocation p/StructurePath obj transform* 2) :transform* (mk-optimized-invocation p/StructurePath obj transform* 2)
}) })
#+cljs
(defn collector-impl [obj] (defn collector-impl [obj]
{:collect-val (mk-optimized-invocation p/Collector obj collect-val 1) {:collect-val (mk-optimized-invocation p/Collector obj collect-val 1)
}) })
)
(defn coerce-collector [this] (defn coerce-collector [this]
(let [cfn (->> this (let [cfn (->> this