Function: byte-opt--bool-value-form

byte-opt--bool-value-form is a byte-compiled function defined in byte-opt.el.gz.

Signature

(byte-opt--bool-value-form FORM)

Documentation

The form in FORM that yields its boolean value, possibly FORM itself.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/byte-opt.el.gz
;; some source-level optimizers
;;
;; when writing optimizers, be VERY careful that the optimizer returns
;; something not EQ to its argument if and ONLY if it has made a change.
;; This implies that you cannot simply destructively modify the list;
;; you must return something not EQ to it if you make an optimization.

(defsubst byte-opt--bool-value-form (form)
  "The form in FORM that yields its boolean value, possibly FORM itself."
  (while (let ((head (car-safe form)))
           (cond ((memq head '( progn inline save-excursion save-restriction
                                save-current-buffer))
                  (setq form (car (last (cdr form))))
                  t)
                 ((memq head '(let let*))
                  (setq form (car (last (cddr form))))
                  t)
                 ((memq head '( prog1 unwind-protect copy-sequence identity
                                reverse nreverse sort))
                  (setq form (nth 1 form))
                  t)
                 ((memq head '(mapc setq setcar setcdr puthash set))
                  (setq form (nth 2 form))
                  t)
                 ((memq head '(aset put function-put))
                  (setq form (nth 3 form))
                  t))))
  form)