mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 07:29:08 -05:00
Add support for preconditions to defc and defcs macros.
This commit is contained in:
parent
67ae149c36
commit
9fb13ba73d
1 changed files with 8 additions and 2 deletions
|
@ -30,8 +30,14 @@
|
|||
(recur (assoc r :mixins mixins) (inc s) (first n) (rest n)))
|
||||
(recur (assoc r :mixins [v]) (inc s) (first n) (rest n)))
|
||||
(recur r (inc s) v n))
|
||||
3 (let [sym (:name r)
|
||||
func `(fn ~sym ~v ~(s/compile-html `(do ~@n)))]
|
||||
3 (if (vector? v)
|
||||
(recur (assoc r :args v) (inc s) (first n) (rest n))
|
||||
(throw (ex-info "Invalid" {})))
|
||||
4 (let [sym (:name r)
|
||||
args (:args r)
|
||||
func (if (map? v)
|
||||
`(fn ~sym ~args ~v ~(s/compile-html `(do ~@n)))
|
||||
`(fn ~sym ~args ~(s/compile-html `(do ~@(cons v n)))))]
|
||||
[func (:doc r) (:mixins r) sym]))))
|
||||
|
||||
(defmacro defc
|
||||
|
|
Loading…
Add table
Reference in a new issue