[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 1c91bc9 1/2: b-c--cond-jump-table-info: Use correct
From: |
Vibhav Pant |
Subject: |
[Emacs-diffs] master 1c91bc9 1/2: b-c--cond-jump-table-info: Use correct body for singleton clauses |
Date: |
Sat, 22 Apr 2017 12:37:51 -0400 (EDT) |
branch: master
commit 1c91bc9221d12618c9fb5507561dd35b7e392cb6
Author: Vibhav Pant <address@hidden>
Commit: Vibhav Pant <address@hidden>
b-c--cond-jump-table-info: Use correct body for singleton clauses
* 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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index aba0710..15dc240 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -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))))))