cljs.spec.impl.gen/dynaload
macro | removed v1.9.542 | added v1.9.14 | Edit |
(dynaload [quote s])
(defmacro dynaload [[quote s]]
(let [xs (string/split (namespace s) #"\.")
cnt (count xs)
checks (map
(fn [n xs]
`(c/exists? ~(symbol (string/join "." (take n xs)))))
(range 2 cnt)
(repeat xs))]
`(cljs.spec.impl.gen/LazyVar.
(fn []
(if (and ~@checks (c/exists? ~s))
~(vary-meta s assoc :cljs.analyzer/no-resolve true)
(throw
(js/Error.
(str "Var " '~s " does not exist, "
(namespace '~s) " never required")))))
nil)))