emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] feature/byte-switch 2db473b: bytecomp.el: Use macroexp-con


From: Vibhav Pant
Subject: [Emacs-diffs] feature/byte-switch 2db473b: bytecomp.el: Use macroexp-const-p instead of bc-cond-valid-obj2-p.
Date: Sun, 5 Feb 2017 17:15:01 +0000 (UTC)

branch: feature/byte-switch
commit 2db473bda8be72cf3c1e4694d70ce48f60492b0e
Author: Vibhav Pant <address@hidden>
Commit: Vibhav Pant <address@hidden>

    bytecomp.el: Use macroexp-const-p instead of bc-cond-valid-obj2-p.
    
    * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-vars): Use
      (macroexp-cons-p) instead of (byte-compile-cond-valid-obj2-p) to
      make sure that obj1/obj2 can be compared with `eq'.
---
 lisp/emacs-lisp/bytecomp.el |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index bddf04a..5aef826 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4001,19 +4001,13 @@ that suppresses all warnings during execution of BODY."
        (byte-compile-out-tag donetag))))
   (setq byte-compile--for-effect nil))
 
-(defun byte-compile-cond-valid-obj2-p (obj)
-  (cond
-   ((consp obj)
-    (and (eq (car obj) 'quote)
-         (= (length obj) 2)
-         (symbolp (cadr obj))))
-   ((symbolp obj) (keywordp obj))
-   (t t)))
-
 (defun byte-compile-cond-vars (obj1 obj2)
+  ;; We make sure that of OBJ1 and OBJ2, one of them is a symbol,
+  ;; and the other is a constant expression whose value can be
+  ;; compared with `eq' (with `macroexp-const-p').
   (or
-   (and (symbolp obj1) (byte-compile-cond-valid-obj2-p obj2) (cons obj1 obj2))
-   (and (symbolp obj2) (byte-compile-cond-valid-obj2-p obj1) (cons obj2 
obj1))))
+   (and (symbolp obj1) (macroexp-const-p obj2) (cons obj1 obj2))
+   (and (symbolp obj2) (macroexp-const-p obj1) (cons obj2 obj1))))
 
 (defun byte-compile-cond-jump-table-info (clauses)
   "If CLAUSES is a `cond' form where:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]