This commit is contained in:
Michiel Borkent 2021-03-13 12:47:25 +01:00
parent 8551817724
commit ea88219ad6

View file

@ -27,10 +27,8 @@
(getProtocols [this] (getProtocols [this]
protocols))] protocols))]
(list 'fn [{:keys '[interfaces methods protocols]}] (list 'fn [{:keys '[interfaces methods protocols]}]
`(cond ~'(empty? interfaces) ~prelude `(cond ~'(empty? interfaces) ~prelude ~'(> (count interfaces)
~'(> (count interfaces) 1) (throw (new Exception "Babashka currently does not support reifying more than one interface."))
1)
(throw (new Exception "Babashka currently does not support reifying more than one interface."))
:else :else
(case (.getName ~(with-meta '(first interfaces) (case (.getName ~(with-meta '(first interfaces)
{:tag 'Class})) {:tag 'Class}))
@ -52,7 +50,7 @@
arity))) arity)))
arities)) arities))
methods))))) methods)))))
methods))))) methods))))))
;; (require 'clojure.pprint) ;; (require 'clojure.pprint)
;; (clojure.pprint/pprint ;; (clojure.pprint/pprint
@ -61,7 +59,7 @@
;; postVisitDirectory [[this p attrs]] ;; postVisitDirectory [[this p attrs]]
;; visitFile [[this p attrs]]}}))) ;; visitFile [[this p attrs]]}})))
#_:clj-kondo/ignore) #_:clj-kondo/ignore
(def reify-fn (def reify-fn
(gen-reify-combos (gen-reify-combos
{java.lang.Object {java.lang.Object