0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-11 09:38:56 -05:00

Improve kondo analyze function for db/with-atomic

Allow pass options as third argument on params vector
This commit is contained in:
Andrey Antukh 2023-09-01 11:37:47 +02:00
parent 07562af677
commit 90f7e97d5b

View file

@ -41,18 +41,22 @@
(defn penpot-with-atomic
[{:keys [node]}]
(let [[_ params & other] (:children node)
(let [[params & body] (rest (:children node))]
(if (api/vector-node? params)
(let [[sym val opts] (:children params)]
(when-not (and sym val)
(throw (ex-info "No sym and val provided" {})))
{:node (api/list-node
(list*
(api/token-node 'let)
(api/vector-node [sym val])
opts
body))})
result (if (api/vector-node? params)
(api/list-node
(into [(api/token-node (symbol "clojure.core" "with-open")) params] other))
(api/list-node
(into [(api/token-node (symbol "clojure.core" "with-open"))
(api/vector-node [params params])]
other)))
]
{:node result}))
{:node (api/list-node
(into [(api/token-node 'let)
(api/vector-node [params params])]
body))})))
(defn penpot-defrecord
[{:keys [:node]}]