From dc5b6c2614d19855f403299d6ca0341df14e011e Mon Sep 17 00:00:00 2001 From: anatoly Date: Tue, 15 Dec 2015 00:27:57 -0500 Subject: [PATCH] cleaning macros (thx @DomKM) removing reader conditionals from defstate, since this part of the macro is compiled by clojure (not cljs) adding ":require-macros [mount.core :refer [defstate]]" to itself (mount.core) to obviate a need for mount clients to do ":require-macros" --- src/mount/core.cljc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mount/core.cljc b/src/mount/core.cljc index ac11e27..5b54fc4 100644 --- a/src/mount/core.cljc +++ b/src/mount/core.cljc @@ -2,7 +2,8 @@ #?(:clj (:require [mount.tools.macro :refer [on-error throw-runtime] :as macro]) :cljs (:require [mount.tools.macro :as macro] [mount.tools.cljs :as cljs])) - #?(:cljs (:require-macros [mount.tools.macro :refer [on-error throw-runtime]]))) + #?(:cljs (:require-macros [mount.tools.macro :refer [on-error throw-runtime]] + [mount.core :refer [defstate]]))) (defonce ^:private -args (atom :no-args)) ;; mostly for command line args and external files (defonce ^:private state-seq (atom 0)) @@ -130,8 +131,7 @@ (defmacro defstate [state & body] (let [[state params] (macro/name-with-attributes state body) {:keys [start stop suspend resume] :as lifecycle} (apply hash-map params) - state-name (with-ns #?(:clj *ns* - :cljs (cljs/this-ns)) state) ;; on cljs side (cljs.analyzer/*cljs-ns*) may do it, but still might not be good for :advanced + state-name (with-ns *ns* state) order (make-state-seq state-name) sym (str state)] (validate lifecycle)