0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-01 11:59:17 -05:00

📎 Improve services defmethod linter hook.

This commit is contained in:
Andrey Antukh 2021-11-18 16:43:52 +01:00 committed by Alonso Torres
parent 25b1c5fe90
commit 8151dcc05f

View file

@ -51,18 +51,28 @@
(defn service-defmethod (defn service-defmethod
[{:keys [:node]}] [{:keys [:node]}]
(let [[rnode rtype & other] (:children node) (let [[rnode rtype ?meta & other] (:children node)
rsym (gensym (name (:k rtype))) rsym (gensym (name (:k rtype)))
result (api/list-node result (api/list-node
[(api/token-node (symbol "do")) [(api/token-node (symbol "do"))
(api/list-node (api/list-node
[(api/token-node (symbol "declare")) [(api/token-node (symbol "declare"))
(api/token-node rsym)]) (api/token-node rsym)])
(if (= :map (:tag ?meta))
(api/list-node
[(api/token-node (symbol "reset-meta!"))
(api/token-node rsym)
?meta])
(api/list-node
[(api/token-node (symbol "comment"))
(api/token-node rsym)]))
(api/list-node (api/list-node
(into [(api/token-node (symbol "defmethod")) (into [(api/token-node (symbol "defmethod"))
(api/token-node rsym) (api/token-node rsym)
rtype] rtype]
other))])] (cons ?meta other)))])]
;; (prn "==============" rtype (into {} ?meta))
;; (prn (api/sexpr result))
{:node result})) {:node result}))