From 218cbcb9331d47070c0b5a506b861f3c943cac08 Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Mon, 23 May 2016 10:36:52 -0400 Subject: [PATCH] use mutable cell for must-cache-paths state for cljs compatibility --- src/clj/com/rpl/specter/impl.cljx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/clj/com/rpl/specter/impl.cljx b/src/clj/com/rpl/specter/impl.cljx index 0388a00..a0f0625 100644 --- a/src/clj/com/rpl/specter/impl.cljx +++ b/src/clj/com/rpl/specter/impl.cljx @@ -642,11 +642,11 @@ #+cljs (atom {}) ) -(def ^:dynamic *must-cache-paths* false) +(def MUST-CACHE-PATHS (mutable-cell false)) (defn must-cache-paths! ([] (must-cache-paths! true)) - ([v] (alter-var-root #'*must-cache-paths* (constantly v)))) + ([v] (set-cell! MUST-CACHE-PATHS v))) #+clj (defn add-path-cache! [k v] @@ -707,7 +707,7 @@ (defn- magic-precompilation* [p params-atom failed-atom] (let [magic-fail! (fn [& reason] - (if *must-cache-paths* + (if (get-cell MUST-CACHE-PATHS) (println "Failed to cache path:" (apply str reason))) (reset! failed-atom true) nil)] @@ -820,7 +820,7 @@ path (magic-precompilation* prepared-path params-atom failed-atom) ] (if @failed-atom - (if *must-cache-paths* + (if (get-cell MUST-CACHE-PATHS) (throw-illegal "Failed to cache path") (->CachedPathInfo nil nil)) (let [precompiled (comp-paths* path)