Skip to content

Commit

Permalink
clojure 1.9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Apr 25, 2024
1 parent 3f65ac1 commit 267466e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
:profiles {:uberjar {:aot :all
:ring {:handler examples.thingie/app}
:source-paths ["examples/thingie/src"]
:dependencies [[org.clojure/clojure "1.10.1"]
:dependencies [[org.clojure/clojure "1.9.0"]
[http-kit "2.3.0"]
[reloaded.repl "0.2.4"]
[com.stuartsierra/component "0.4.0"]]}
:dev {:plugins [[lein-clojars "0.9.1"]
[lein-ring "0.12.5"]
[funcool/codeina "0.5.0"]]
:dependencies [[org.clojure/clojure "1.10.1"]
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/core.unify "0.6.0"]
[org.clojure/core.async "0.6.532"]
[javax.servlet/javax.servlet-api "4.0.1"]
Expand Down
21 changes: 12 additions & 9 deletions src/compojure/api/meta.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"lexically bound ring-request for handlers."
'+compojure-api-request+)

(defn- var->sym [^clojure.lang.Var v]
(symbol (-> v .ns ns-name name) (-> v .sym name)))

;;
;; Schema
;;
Expand Down Expand Up @@ -716,7 +719,7 @@
(when (symbol? sym)
(when-some [v (resolve &env sym)]
(when (var? v)
(let [sym (symbol v)]
(let [sym (var->sym v)]
(or (endpoint-vars sym)
(and (routes-vars sym)
(static-body? &env (next form))))))))))))
Expand All @@ -731,7 +734,7 @@
(when (symbol? sym)
(when-some [v (resolve &env sym)]
(when (var? v)
(let [sym (symbol v)]
(let [sym (var->sym v)]
(when (and (resource-vars sym)
(= 2 (count form)))
(let [[_ data] form]
Expand All @@ -751,7 +754,7 @@
(when (symbol? sym)
(when-some [v (resolve &env sym)]
(when (var? v)
(context-vars (symbol v)))))))))
(context-vars (var->sym v)))))))))

(def middleware-vars (into #{}
(mapcat (fn [n]
Expand All @@ -767,7 +770,7 @@
(when (symbol? sym)
(when-some [v (resolve &env sym)]
(when (var? v)
(when (middleware-vars (symbol v))
(when (middleware-vars (var->sym v))
(let [[_ path route-arg & args] body
[options body] (extract-parameters args true)]
(static-body? &env body))))))))))
Expand All @@ -788,7 +791,7 @@
(when (symbol? sym)
(when-some [v (resolve &env sym)]
(when (var? v)
(when (route-middleware-vars (symbol v))
(when (route-middleware-vars (var->sym v))
(let [[_ mids & body] body]
(and (some? mids)
(static-body? &env body)))))))))))
Expand Down Expand Up @@ -850,19 +853,19 @@
(and (seq? form)
('#{clojure.spec.alpha/keys}
(some-> (resolve-var &env (first form))
symbol)))
var->sym)))
(and (seq? form)
(symbol? (first form))
(when-some [v (resolve-var &env (first form))]
(when (or (#{"spec-tools.data-spec"
"spec-tools.core"
"schema.core"
"ring.util.http-response"}
(namespace (symbol v)))
(namespace (var->sym v)))
('#{compojure.api.sweet/describe
ring.swagger.json-schema/describe
clojure.core/constantly}
(symbol v)))
(var->sym v)))
(when-not (some #{:dynamic :macro} (meta v))
(every? #(static-form? &env %) (next form))))))))

Expand Down Expand Up @@ -894,7 +897,7 @@
(when-some [op (or (when (= 'let* (first form))
'let*)
(when-some [v (resolve-var &env (first form))]
(let [sym (symbol v)]
(let [sym (var->sym v)]
(when (contains?
'#{clojure.core/let clojure.core/for
compojure.api.sweet/let-routes compojure.api.core/let-routes}
Expand Down

0 comments on commit 267466e

Please sign in to comment.