]> git.eshelyaron.com Git - emacs.git/commitdiff
Optimise (cond) => nil at source level
authorMattias Engdegård <mattiase@acm.org>
Tue, 2 Nov 2021 13:48:55 +0000 (14:48 +0100)
committerMattias Engdegård <mattiase@acm.org>
Tue, 2 Nov 2021 21:46:20 +0000 (22:46 +0100)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-cond):
Optimise clause-free `cond`, which can arise from earlier
transformations.  This enables further optimisations.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test cases.

lisp/emacs-lisp/byte-opt.el
test/lisp/emacs-lisp/bytecomp-tests.el

index 9b3b2e5ce14cc6c0a325fb769d0771e69c3e1ec2..9c64083b64bbf04ea68296c1cef04d846dd4049f 100644 (file)
@@ -1327,7 +1327,7 @@ See Info node `(elisp) Integer Basics'."
            (list 'or (car (car clauses))
                  (byte-optimize-cond
                   (cons (car form) (cdr (cdr form)))))
-         form))
+         (and clauses form)))
     form))
 
 (defun byte-optimize-if (form)
index a6e224b3d2c6c366d7846541d1aea1a3ae04311f..41edc1f8289b131a279b697ea14504bc8a330110 100644 (file)
@@ -640,6 +640,9 @@ inner loops respectively."
            (f (list (lambda (x) (setq a x)))))
       (funcall (car f) 3)
       (list a b))
+
+    (cond)
+    (mapcar (lambda (x) (cond ((= x 0)))) '(0 1))
     )
   "List of expressions for cross-testing interpreted and compiled code.")