Function: byte-compile-nilconstp

byte-compile-nilconstp is a byte-compiled function defined in byte-opt.el.gz.

Signature

(byte-compile-nilconstp FORM)

Documentation

Return non-nil if FORM always evaluates to a nil value.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/byte-opt.el.gz
(defun byte-compile-nilconstp (form)
  "Return non-nil if FORM always evaluates to a nil value."
  (setq form (byte-opt--bool-value-form form))
  (or (not form)   ; assume (quote nil) always being normalized to nil
      (and (consp form)
           (let ((head (car form)))
             (cond ((memq head
                          ;; Some forms that are statically nil.
                          ;; FIXME: Replace with a function property?
                          '( while ignore
                             insert insert-and-inherit insert-before-markers
                             insert-before-markers-and-inherit
                             insert-char insert-byte insert-buffer-substring
                             delete-region delete-char
                             widen narrow-to-region transpose-regions
                             forward-char backward-char
                             beginning-of-line end-of-line
                             erase-buffer buffer-swap-text
                             delete-overlay delete-all-overlays
                             remhash
                             maphash
                             map-charset-chars map-char-table
                             mapbacktrace
                             mapatoms
                             ding beep sleep-for
                             json-insert
                             set-match-data
                             ))
                    t)
                   ((eq head 'if)
                    (and (byte-compile-nilconstp (nth 2 form))
                         (byte-compile-nilconstp (car (last (cdddr form))))))
                   ((memq head '(not null))
                    (byte-compile-trueconstp (cadr form)))
                   ((eq head 'and)
                    (and (cdr form)
                         (byte-compile-nilconstp (car (last (cdr form)))))))))))