Function: byte-compile-check-variable
byte-compile-check-variable is a byte-compiled function defined in
bytecomp.el.gz.
Signature
(byte-compile-check-variable VAR ACCESS-TYPE)
Documentation
Do various error checks before a use of the variable VAR.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-check-variable (var access-type)
"Do various error checks before a use of the variable VAR."
(cond ((or (not (symbolp var)) (macroexp--const-symbol-p var))
(when (byte-compile-warning-enabled-p 'constants
(and (symbolp var) var))
(byte-compile-warn-x
var
(if (eq access-type 'let-bind)
"attempt to let-bind %s `%s'"
"variable reference to %s `%s'")
(if (symbolp var) "constant" "nonvariable")
var)))
((let ((od (get var 'byte-obsolete-variable)))
(and od
(not (memq var byte-compile-not-obsolete-vars))
(not (memq var byte-compile-global-not-obsolete-vars))
(not (memq var byte-compile-lexical-variables))
(pcase (nth 1 od)
('set (not (eq access-type 'reference)))
('get (eq access-type 'reference))
(_ t))))
(byte-compile-warn-obsolete var "variable"))))