Improve error message when passing invalid defscreen args
This commit is contained in:
@@ -465,8 +465,15 @@ via the screen map.
|
|||||||
(println (:initial-distance screen)) ; the start distance between fingers
|
(println (:initial-distance screen)) ; the start distance between fingers
|
||||||
(println (:distance screen)) ; the end distance between fingers
|
(println (:distance screen)) ; the end distance between fingers
|
||||||
entities))"
|
entities))"
|
||||||
[n & {:keys [] :as options}]
|
[n & options]
|
||||||
`(let [fn-syms# (->> (for [[k# v#] ~options]
|
; make sure the options are valid
|
||||||
|
(let [s (format "Unexpected value in (defscreen %s). Make sure you give it
|
||||||
|
keywords and functions in pairs."
|
||||||
|
(str n))]
|
||||||
|
(assert (even? (count options)) s)
|
||||||
|
(assert (= 0 (count (remove keyword? (keys (apply hash-map options))))) s))
|
||||||
|
; return form calling defscreen*
|
||||||
|
`(let [fn-syms# (->> (for [[k# v#] ~(apply hash-map options)]
|
||||||
[k# (intern *ns* (symbol (str '~n "-" (name k#))) v#)])
|
[k# (intern *ns* (symbol (str '~n "-" (name k#))) v#)])
|
||||||
flatten
|
flatten
|
||||||
(apply hash-map))
|
(apply hash-map))
|
||||||
|
|||||||
Reference in New Issue
Block a user