Skip to content

Commit

Permalink
meth fn
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Oct 10, 2024
1 parent b9a2496 commit 82bf12b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/sci/impl/analyzer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1802,21 +1802,22 @@
nil))))))

#?(:clj
(defn analyze-interop-ifn [ctx expr [^Class clazz meth] mv]
(defn analyze-interop-ifn [_ctx expr [^Class clazz meth]]
(let [stack (assoc (meta expr)
:ns @utils/current-ns
:file @utils/current-file)]
(if-let [_fld (try (Reflector/getStaticField ^Class clazz ^String (str meth))
(catch IllegalArgumentException _
(prn :not-a-field)
nil))]
(sci.impl.types/->Node
(interop/get-static-field clazz (str meth))
stack)
;; HERE we are pretty sure that we should produce a method-fn
(.getMethods clazz)
))
))
(sci.impl.types/->Node
(fn [& args]
(Reflector/invokeStaticMethod
(.getName clazz) (str meth)
^objects (into-array Object args)))
stack)))))

#?(:clj
(comment
Expand Down Expand Up @@ -1857,7 +1858,7 @@
(faster/deref-1 v)
nil))))
(:sci.impl.analyzer/interop-ifn mv)
(analyze-interop-ifn ctx expr v mv)
(analyze-interop-ifn ctx expr v)
:else v))
;; don't evaluate records, this check needs to go before map?
;; since a record is also a map
Expand Down

0 comments on commit 82bf12b

Please sign in to comment.