Skip to content

Commit

Permalink
-dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Apr 22, 2024
1 parent 779984f commit 2e798e6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/compojure/api/meta.clj
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,10 @@
(= 2 (count form))
(= 'var (first form)))
(when (symbol? form)
((some-fn var? class?) (resolve &env form))))))
(let [r (resolve &env form)]
(or (class? r)
(and (var? r)
(not (:dynamic (meta r))))))))))

(defn- static-expansion? [&env form]
(boolean
Expand Down Expand Up @@ -861,7 +864,7 @@
ring.swagger.json-schema/describe
clojure.core/constantly}
(symbol v)))
(when-not (:macro (meta v))
(when-not (some #{:dynamic :macro} (meta v))
(every? #(static-form? &env %) (next form))))))))

(defn- static-binder-env [&env bv]
Expand All @@ -882,14 +885,13 @@
(symbol? (first form))
(when-some [op (or (when (= 'let* (first form))
'let*)
(let [v (resolve &env (first form))]
(when (var? v)
(let [sym (symbol v)]
(when (contains?
'#{clojure.core/let clojure.core/for
compojure.api.sweet/let-routes compojure.api.core/let-routes}
sym)
sym)))))]
(when-some [v (resolve-var &env (first form))]
(let [sym (symbol v)]
(when (contains?
'#{clojure.core/let clojure.core/for
compojure.api.sweet/let-routes compojure.api.core/let-routes}
sym)
sym))))]
(let [;; expand destructuring
[_ bv & body] (macroexpand
(if ('#{compojure.api.sweet/let-routes compojure.api.core/let-routes} op)
Expand Down

0 comments on commit 2e798e6

Please sign in to comment.