Function: cider-resolve--var

cider-resolve--var is a byte-compiled function defined in cider-resolve.el.

Signature

(cider-resolve--var CACHE NS VAR CORE-NS)

Documentation

Resolve VAR in namespace NS against the namespace CACHE dict.

CORE-NS is the core namespace ("clojure.core" or "cljs.core") that an unqualified, non-referred VAR falls back to. Helper for cider-resolve-var; recurses on CACHE instead of re-resolving the connection on every lookup. See cider-resolve-var for the contract.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-resolve.el
(defun cider-resolve--var (cache ns var core-ns)
  "Resolve VAR in namespace NS against the namespace CACHE dict.
CORE-NS is the core namespace (\"clojure.core\" or \"cljs.core\") that an
unqualified, non-referred VAR falls back to.  Helper for `cider-resolve-var';
recurses on CACHE instead of re-resolving the connection on every lookup.
See `cider-resolve-var' for the contract."
  (let* ((var-ns (when (string-match cider-resolve--prefix-regexp var)
                   (let ((alias (match-string 1 var)))
                     (or (nrepl-dict-get-in cache (list ns "aliases" alias))
                         alias))))
         (name (replace-regexp-in-string cider-resolve--prefix-regexp "" var)))
    (or
     (nrepl-dict-get-in cache (list (or var-ns ns) "interns" name))
     (unless var-ns
       ;; If the var had no prefix, it might be referred.
       (if-let* ((referral (nrepl-dict-get-in cache (list ns "refers" name))))
           (cider-resolve--var cache ns referral core-ns)
         ;; Or it might be from core.
         (unless (equal ns core-ns)
           (cider-resolve--var cache core-ns name core-ns)))))))