diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2021-02-12 19:41:07 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2021-02-12 20:52:05 +0100 |
commit | 5a11e9185c0416df8fa3a15bb0d60b6ba6827869 (patch) | |
tree | 56a19ffbc92ca9265e8f02b8a4bea345ae5b35de /lisp/emacs-lisp | |
parent | ea29908c1870417eba98f27525a6f2f571d65396 (diff) | |
download | emacs-5a11e9185c0416df8fa3a15bb0d60b6ba6827869.tar.gz emacs-5a11e9185c0416df8fa3a15bb0d60b6ba6827869.tar.bz2 emacs-5a11e9185c0416df8fa3a15bb0d60b6ba6827869.zip |
byte-opt.el: More concise expression
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Refactor `setq` clause.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index fec3407782e..c383e0285b9 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -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))) |