mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
Elide broken but unnecessary if optimisations
* lisp/emacs-lisp/byte-opt.el (byte-optimize-if):
Remove explicit clauses purposing to simplify
(if X nil t) -> (not X)
(if X t nil) -> (not (not X))
but never did so because of a coding mistake (eq instead of equal),
found by a recently added warning. They weren't actually needed
thanks to the optimiser's fixpoint iteration: we eventually get the
same results through
(if X nil t) -> (if (not X) t nil) -> (if (not X) t) -> (not X)
(if X t nil) -> (if X t) -> (not (not X))
This commit is contained in:
parent
17d65c99cd
commit
13aa376e93
1 changed files with 2 additions and 5 deletions
|
|
@ -1297,11 +1297,8 @@ See Info node `(elisp) Integer Basics'."
|
||||||
(if else
|
(if else
|
||||||
`(progn ,condition ,@else)
|
`(progn ,condition ,@else)
|
||||||
condition))
|
condition))
|
||||||
;; (if X nil t) -> (not X)
|
;; (if X t) -> (not (not X))
|
||||||
((and (eq then nil) (eq else '(t)))
|
((and (eq then t) (null else))
|
||||||
`(not ,condition))
|
|
||||||
;; (if X t [nil]) -> (not (not X))
|
|
||||||
((and (eq then t) (or (null else) (eq else '(nil))))
|
|
||||||
`(not ,(byte-opt--negate condition)))
|
`(not ,(byte-opt--negate condition)))
|
||||||
;; (if VAR VAR X...) -> (or VAR (progn X...))
|
;; (if VAR VAR X...) -> (or VAR (progn X...))
|
||||||
((and (symbolp condition) (eq condition then))
|
((and (symbolp condition) (eq condition then))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue