emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117005: Remove excess parameters on cl--const-expr-


From: Daniel Colascione
Subject: [Emacs-diffs] trunk r117005: Remove excess parameters on cl--const-expr-val
Date: Mon, 21 Apr 2014 18:00:39 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117005
revision-id: address@hidden
parent: address@hidden
committer: Daniel Colascione <address@hidden>
branch nick: trunk
timestamp: Mon 2014-04-21 11:00:19 -0700
message:
  Remove excess parameters on cl--const-expr-val
  
  2014-04-21  Daniel Colascione  <address@hidden>
  
        * emacs-lisp/cl-macs.el (cl--const-expr-val): We didn't need the
        last two parameters after all.
        (cl--expr-contains,cl--compiler-macro-typep,cl--compiler-macro-member)
        (cl--compiler-macro-assoc,cl-struct-slot-value)
        (cl-struct-set-slot-value): Stop using them.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/cl-macs.el     clmacs.el-20091113204419-o5vbwnq5f7feedwu-612
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-04-21 14:34:49 +0000
+++ b/lisp/ChangeLog    2014-04-21 18:00:19 +0000
@@ -1,4 +1,12 @@
-2014-04-21  Stefan Monnier  <address@hidden>
+2014-04-21  Daniel Colascione  <address@hidden>
+
+       * emacs-lisp/cl-macs.el (cl--const-expr-val): We didn't need the
+       last two parameters after all.
+       (cl--expr-contains,cl--compiler-macro-typep,cl--compiler-macro-member)
+       (cl--compiler-macro-assoc,cl-struct-slot-value)
+       (cl-struct-set-slot-value): Stop using them.
+
+(2014-04-21  Stefan Monnier  <address@hidden>
 
        * image-mode.el (image-mode-window-put): Don't assume there's a `t'
        entry in image-mode-winprops-alist.

=== modified file 'lisp/emacs-lisp/cl-macs.el'
--- a/lisp/emacs-lisp/cl-macs.el        2014-04-21 01:03:39 +0000
+++ b/lisp/emacs-lisp/cl-macs.el        2014-04-21 18:00:19 +0000
@@ -134,15 +134,14 @@
        ((symbolp x) (and (memq x '(nil t)) t))
        (t t)))
 
-(defun cl--const-expr-val (x &optional environment default)
+(defun cl--const-expr-val (x)
   "Return the value of X known at compile-time.
-If X is not known at compile time, return DEFAULT.  Before
-testing whether X is known at compile time, macroexpand it in
-ENVIRONMENT."
-  (let ((x (macroexpand-all x environment)))
+If X is not known at compile time, return nil.  Before testing
+whether X is known at compile time, macroexpand it completely in
+`macroexpand-all-environment'."
+  (let ((x (macroexpand-all x macroexpand-all-environment)))
     (if (macroexp-const-p x)
-        (if (consp x) (nth 1 x) x)
-      default)))
+        (if (consp x) (nth 1 x) x))))
 
 (defun cl--expr-contains (x y)
   "Count number of times X refers to Y.  Return nil for 0 times."
@@ -526,8 +525,7 @@
                                 look
                               `(or ,look
                                     ,(if (eq (cl--const-expr-p def) t)
-                                        `'(nil ,(cl--const-expr-val
-                                                  def 
macroexpand-all-environment))
+                                        `'(nil ,(cl--const-expr-val def))
                                       `(list nil ,def))))))))
              (push karg keys)))))
       (setq keys (nreverse keys))
@@ -2689,8 +2687,7 @@
 (defun cl--compiler-macro-typep (form val type)
   (if (macroexp-const-p type)
       (macroexp-let2 macroexp-copyable-p temp val
-        (cl--make-type-test temp (cl--const-expr-val
-                                  type macroexpand-all-environment)))
+        (cl--make-type-test temp (cl--const-expr-val type)))
     form))
 
 ;;;###autoload
@@ -2866,8 +2863,7 @@
 
 (defun cl--compiler-macro-member (form a list &rest keys)
   (let ((test (and (= (length keys) 2) (eq (car keys) :test)
-                  (cl--const-expr-val (nth 1 keys)
-                                       macroexpand-all-environment))))
+                  (cl--const-expr-val (nth 1 keys)))))
     (cond ((eq test 'eq) `(memq ,a ,list))
          ((eq test 'equal) `(member ,a ,list))
          ((or (null keys) (eq test 'eql)) `(memql ,a ,list))
@@ -2875,12 +2871,11 @@
 
 (defun cl--compiler-macro-assoc (form a list &rest keys)
   (let ((test (and (= (length keys) 2) (eq (car keys) :test)
-                  (cl--const-expr-val (nth 1 keys)
-                                       macroexpand-all-environment))))
+                  (cl--const-expr-val (nth 1 keys)))))
     (cond ((eq test 'eq) `(assq ,a ,list))
          ((eq test 'equal) `(assoc ,a ,list))
          ((and (macroexp-const-p a) (or (null keys) (eq test 'eql)))
-          (if (floatp (cl--const-expr-val a macroexpand-all-environment))
+          (if (floatp (cl--const-expr-val a))
               `(assoc ,a ,list) `(assq ,a ,list)))
          (t form))))
 
@@ -2960,9 +2955,8 @@
 
 (cl-define-compiler-macro cl-struct-slot-value
     (&whole orig struct-type slot-name inst)
-  (or (let* ((macenv macroexpand-all-environment)
-             (struct-type (cl--const-expr-val struct-type macenv))
-             (slot-name (cl--const-expr-val slot-name macenv)))
+  (or (let* ((struct-type (cl--const-expr-val struct-type))
+             (slot-name (cl--const-expr-val slot-name)))
         (and struct-type (symbolp struct-type)
              slot-name (symbolp slot-name)
              (assq slot-name (cl-struct-slot-info struct-type))
@@ -2974,9 +2968,8 @@
 
 (cl-define-compiler-macro cl-struct-set-slot-value
     (&whole orig struct-type slot-name inst value)
-  (or (let* ((macenv macroexpand-all-environment)
-             (struct-type (cl--const-expr-val struct-type macenv))
-             (slot-name (cl--const-expr-val slot-name macenv)))
+  (or (let* ((struct-type (cl--const-expr-val struct-type))
+             (slot-name (cl--const-expr-val slot-name)))
         (and struct-type (symbolp struct-type)
              slot-name (symbolp slot-name)
              (assq slot-name (cl-struct-slot-info struct-type))


reply via email to

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