]> git.eshelyaron.com Git - emacs.git/commitdiff
b-c--cond-jump-table-info: Use correct body for singleton clauses
authorVibhav Pant <vibhavp@gmail.com>
Sat, 22 Apr 2017 15:08:53 +0000 (20:38 +0530)
committerVibhav Pant <vibhavp@gmail.com>
Sat, 22 Apr 2017 16:38:15 +0000 (22:08 +0530)
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table-info):
When a clause's body consists of a single constant expression, use
that expression as the body to be compiled. This fixes switch bytecode
evaluating to nil to such clauses.

lisp/emacs-lisp/bytecomp.el

index aba07102055d3f27d10e2e07bb3bc29b66b16fe0..15dc24060aa66adef3dc25902a9fef421dbb6cda 100644 (file)
@@ -4066,8 +4066,8 @@ Return a list of the form ((TEST . VAR)  ((VALUE BODY) ...))"
                         ;; discard duplicate clauses
                         (not (assq obj2 cases)))
                    (push (list (if (consp obj2) (eval obj2) obj2) body) cases)
-                 (if (eq condition t)
-                     (progn (push (list 'default body) cases)
+                 (if (and (macroexp-const-p condition) condition)
+                     (progn (push (list 'default (or body `(,condition))) cases)
                             (throw 'break t))
                    (setq ok nil)
                    (throw 'break nil))))))