Don't hide not
and null
arity errors
* lisp/emacs-lisp/byte-opt.el (byte-optimize-not): Don't silently convert incorrect `not` and `null` applications to nil.
This commit is contained in:
parent
175a513d19
commit
923aad81d4
1 changed files with 8 additions and 7 deletions
|
@ -1410,13 +1410,14 @@ See Info node `(elisp) Integer Basics'."
|
|||
form)))
|
||||
|
||||
(defun byte-optimize-not (form)
|
||||
(and (= (length form) 2)
|
||||
(let ((arg (nth 1 form)))
|
||||
(cond ((null arg) t)
|
||||
((macroexp-const-p arg) nil)
|
||||
((byte-compile-nilconstp arg) `(progn ,arg t))
|
||||
((byte-compile-trueconstp arg) `(progn ,arg nil))
|
||||
(t form)))))
|
||||
(if (= (length form) 2)
|
||||
(let ((arg (nth 1 form)))
|
||||
(cond ((null arg) t)
|
||||
((macroexp-const-p arg) nil)
|
||||
((byte-compile-nilconstp arg) `(progn ,arg t))
|
||||
((byte-compile-trueconstp arg) `(progn ,arg nil))
|
||||
(t form)))
|
||||
form))
|
||||
|
||||
(put 'and 'byte-optimizer #'byte-optimize-and)
|
||||
(put 'or 'byte-optimizer #'byte-optimize-or)
|
||||
|
|
Loading…
Add table
Reference in a new issue