Function: byte-compile-trueconstp
byte-compile-trueconstp is a byte-compiled function defined in
byte-opt.el.gz.
Signature
(byte-compile-trueconstp FORM)
Documentation
Return non-nil if FORM always evaluates to a non-nil value.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/byte-opt.el.gz
(defun byte-compile-trueconstp (form)
"Return non-nil if FORM always evaluates to a non-nil value."
(setq form (byte-opt--bool-value-form form))
(cond ((consp form)
(let ((head (car form)))
;; FIXME: Lots of other expressions are statically non-nil.
(cond ((memq head '(quote function)) (cadr form))
((eq head 'list) (cdr form))
((memq head
;; FIXME: Replace this list with a function property?
'( length safe-length cons lambda
string unibyte-string make-string concat
format format-message
substring substring-no-properties string-replace
replace-regexp-in-string symbol-name make-symbol
compare-strings string-distance
mapconcat
vector make-vector vconcat make-record record
regexp-quote regexp-opt
buffer-string buffer-substring
buffer-substring-no-properties
current-buffer buffer-size get-buffer-create
point point-min point-max buffer-end count-lines
following-char preceding-char get-byte max-char
region-beginning region-end
line-beginning-position line-end-position
pos-bol pos-eol
+ - * / % 1+ 1- min max abs mod expt logb
logand logior logxor lognot ash logcount
floor ceiling round truncate
sqrt sin cos tan asin acos atan exp log copysign
ffloor fceiling fround ftruncate float
ldexp frexp
number-to-string string-to-number
int-to-string char-to-string
prin1-to-string read-from-string
byte-to-string string-to-vector string-to-char
capitalize upcase downcase
propertize
string-as-multibyte string-as-unibyte
string-to-multibyte string-to-unibyte
string-make-multibyte string-make-unibyte
string-width char-width
make-hash-table hash-table-count
unibyte-char-to-multibyte multibyte-char-to-unibyte
sxhash sxhash-equal sxhash-eq sxhash-eql
sxhash-equal-including-properties
make-marker copy-marker point-marker mark-marker
set-marker
kbd key-description
always))
t)
((eq head 'if)
(and (byte-compile-trueconstp (nth 2 form))
(byte-compile-trueconstp (car (last (cdddr form))))))
((memq head '(not null))
(byte-compile-nilconstp (cadr form)))
((eq head 'or)
(and (cdr form)
(byte-compile-trueconstp (car (last (cdr form)))))))))
((not (symbolp form)))
((eq form t))
((keywordp form))))