(defn state-machine [body num-user-params [crossing-env env] user-transitions]
(binding [an-jvm/run-passes run-passes]
(-> (an-jvm/analyze `(let [~@(if (nested-go? env)
(mapcat (fn [[l {:keys [tag]}]]
(emit-hinted l tag crossing-env))
env)
(mapcat (fn [[l ^clojure.lang.Compiler$LocalBinding lb]]
(emit-hinted l (when (.hasJavaClass lb)
(some-> lb .getJavaClass .getName))
crossing-env))
env))]
~body)
(make-env env crossing-env)
{:passes-opts (merge an-jvm/default-passes-opts
{:uniquify/uniquify-env true
:mark-transitions/transitions user-transitions})})
(parse-to-state-machine user-transitions)
second
(emit-state-machine num-user-params user-transitions))))