Function: byte-compile-free-vars-warn

byte-compile-free-vars-warn is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile-free-vars-warn ARG VAR &optional ASSIGNMENT)

Documentation

Warn if symbol VAR refers to a free variable.

VAR must not be lexically bound. ARG is a position argument, used by byte-compile-warn-x. If optional argument ASSIGNMENT is non-nil, this is treated as an assignment (i.e. setq).

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-free-vars-warn (arg var &optional assignment)
  "Warn if symbol VAR refers to a free variable.
VAR must not be lexically bound.
ARG is a position argument, used by `byte-compile-warn-x'.
If optional argument ASSIGNMENT is non-nil, this is treated as an
assignment (i.e. `setq')."
  (unless (or (boundp var)
              (memq var byte-compile-bound-variables)
              (memq var (if assignment
                            byte-compile-free-assignments
                          byte-compile-free-references))
              (not (byte-compile-warning-enabled-p 'free-vars var)))
    (let* ((varname (prin1-to-string var))
           (desc (if assignment "assignment" "reference"))
           (suggestions (help-uni-confusable-suggestions varname)))
      (byte-compile-warn-x arg "%s to free variable `%s'%s"
                           desc var
                           (if suggestions (concat "\n  " suggestions) "")))
    (push var (if assignment
                  byte-compile-free-assignments
                byte-compile-free-references))))