]> git.eshelyaron.com Git - emacs.git/commitdiff
byte-opt.el: More concise expression
authorMattias Engdegård <mattiase@acm.org>
Fri, 12 Feb 2021 18:41:07 +0000 (19:41 +0100)
committerMattias Engdegård <mattiase@acm.org>
Fri, 12 Feb 2021 19:52:05 +0000 (20:52 +0100)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Refactor `setq` clause.

lisp/emacs-lisp/byte-opt.el

index fec3407782ee88631fd073c2fff21bada9cb81aa..c383e0285b99ec19d13b25c3530c775ffd255182 100644 (file)
@@ -593,16 +593,15 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.")
                   (lexvar (assq var byte-optimize--lexvars))
                   (value (byte-optimize-form expr nil)))
              (when lexvar
-               ;; If it's bound outside conditional, invalidate.
-               (if (assq var byte-optimize--vars-outside-condition)
-                   ;; We are in conditional code and the variable was
-                   ;; bound outside: cancel substitutions.
-                   (setcdr (cdr lexvar) nil)
-                 ;; Set a new value (if substitutable).
-                 (setcdr (cdr lexvar)
-                         (and (byte-optimize--substitutable-p value)
-                              (list value))))
-               (setcar (cdr lexvar) t)) ; Mark variable to be kept.
+               ;; Set a new value or inhibit further substitution.
+               (setcdr (cdr lexvar)
+                       (and
+                        ;; Inhibit if bound outside conditional code.
+                        (not (assq var byte-optimize--vars-outside-condition))
+                        ;; The new value must be substitutable.
+                        (byte-optimize--substitutable-p value)
+                        (list value)))
+               (setcar (cdr lexvar) t))   ; Mark variable to be kept.
              (push var var-expr-list)
              (push value var-expr-list))
            (setq args (cddr args)))