state machine macro bugfixes

This commit is contained in:
Jeremy Penner 2013-04-05 21:10:54 -04:00
parent 4b6519aa13
commit a239d83dfa

View file

@ -153,12 +153,12 @@
(case (count body)
0 [[] [nil]]
1 [[] body]
body)
[(first body) (next body)])
params
(if (< (count params) numargs)
(into params (repeatedly (- numargs (count params)) #(gensym)))
params)]
[params exprs]))
(concat [params] exprs)))
(defn call-stmfunc [fn opts args statenext]
(let [stm (first args)
@ -166,7 +166,7 @@
args (if (:pass-next-state opts) (concat args [statenext]) args)
result (apply fn args)
stm (if (:returns-value opts) (goto stm (state stm) result) (or result stm))
stm (if (:advances opts) (goto stm statenext (value stm)))]
stm (if (:advances opts) (goto stm statenext (value stm)) stm)]
stm))
(defn- handler-matches [stm handler event]