state machine macro bugfixes
This commit is contained in:
parent
4b6519aa13
commit
a239d83dfa
|
@ -153,12 +153,12 @@
|
||||||
(case (count body)
|
(case (count body)
|
||||||
0 [[] [nil]]
|
0 [[] [nil]]
|
||||||
1 [[] body]
|
1 [[] body]
|
||||||
body)
|
[(first body) (next body)])
|
||||||
params
|
params
|
||||||
(if (< (count params) numargs)
|
(if (< (count params) numargs)
|
||||||
(into params (repeatedly (- numargs (count params)) #(gensym)))
|
(into params (repeatedly (- numargs (count params)) #(gensym)))
|
||||||
params)]
|
params)]
|
||||||
[params exprs]))
|
(concat [params] exprs)))
|
||||||
|
|
||||||
(defn call-stmfunc [fn opts args statenext]
|
(defn call-stmfunc [fn opts args statenext]
|
||||||
(let [stm (first args)
|
(let [stm (first args)
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
args (if (:pass-next-state opts) (concat args [statenext]) args)
|
args (if (:pass-next-state opts) (concat args [statenext]) args)
|
||||||
result (apply fn args)
|
result (apply fn args)
|
||||||
stm (if (:returns-value opts) (goto stm (state stm) result) (or result stm))
|
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))
|
stm))
|
||||||
|
|
||||||
(defn- handler-matches [stm handler event]
|
(defn- handler-matches [stm handler event]
|
||||||
|
|
Loading…
Reference in a new issue