Function: byte-compile--maybe-guarded
byte-compile--maybe-guarded is a byte-compiled function defined in
bytecomp.el.gz.
Signature
(byte-compile--maybe-guarded CONDITION BODY-FUN)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile--maybe-guarded (condition body-fun)
(let* ((fbound-list (byte-compile-find-bound-condition
condition '(fboundp functionp)
byte-compile-unresolved-functions))
(bound-list (byte-compile-find-bound-condition
condition '(boundp default-boundp local-variable-p)))
(new-bound-list
;; (seq-difference byte-compile-bound-variables))
(delq nil (mapcar (lambda (s)
(if (memq s byte-compile-bound-variables) nil s))
bound-list)))
;; Maybe add to the bound list.
(byte-compile-bound-variables
(append new-bound-list byte-compile-bound-variables)))
(mapc #'byte-compile--check-prefixed-var new-bound-list)
(unwind-protect
;; If things not being bound at all is ok, so must them being
;; obsolete. Note that we add to the existing lists since Tramp
;; (ab)uses this feature.
;; FIXME: If `foo' is obsoleted by `bar', the code below
;; correctly arranges to silence the warnings after testing
;; existence of `foo', but the warning should also be
;; silenced after testing the existence of `bar'.
(let ((byte-compile-not-obsolete-vars
(append byte-compile-not-obsolete-vars bound-list))
(byte-compile-not-obsolete-funcs
(append byte-compile-not-obsolete-funcs fbound-list)))
(funcall body-fun))
;; Maybe remove the function symbol from the unresolved list.
(dolist (fbound fbound-list)
(when fbound
(setq byte-compile-unresolved-functions
(delq (assq fbound byte-compile-unresolved-functions)
byte-compile-unresolved-functions)))))))