Function: byte-optimize--substitutable-p

byte-optimize--substitutable-p is a byte-compiled function defined in byte-opt.el.gz.

Signature

(byte-optimize--substitutable-p EXPR)

Documentation

Whether EXPR is a constant that can be propagated.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/byte-opt.el.gz
(defun byte-optimize--substitutable-p (expr)
  "Whether EXPR is a constant that can be propagated."
  ;; Only consider numbers, symbols and strings to be values for substitution
  ;; purposes.  Numbers and symbols are immutable, and mutating string
  ;; literals (or results from constant-evaluated string-returning functions)
  ;; can be considered undefined.
  ;; (What about other quoted values, like conses?)
  (or (booleanp expr)
      (numberp expr)
      (stringp expr)
      (and (consp expr)
           (or (and (memq (car expr) '(quote function))
                    (symbolp (cadr expr)))
               ;; (internal-get-closed-var N) can be considered constant for
               ;; const-prop purposes.
               (and (eq (car expr) 'internal-get-closed-var)
                    (integerp (cadr expr)))))
      (keywordp expr)))