[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1ba5b64: Optimise 'while' bodies for effect
From: |
Mattias Engdegård |
Subject: |
master 1ba5b64: Optimise 'while' bodies for effect |
Date: |
Thu, 26 Dec 2019 13:41:32 -0500 (EST) |
branch: master
commit 1ba5b64dd1f0c0b22f3945ddc8b236fd565ebee8
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Optimise 'while' bodies for effect
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Treat all expressions in the body of 'while' as for-effect,
since their values are discarded. This also finds some errors.
---
lisp/emacs-lisp/byte-opt.el | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 22fea1b..07fd548 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -480,6 +480,13 @@
backwards)))))
(cons fn (mapcar 'byte-optimize-form (cdr form)))))
+ ((eq fn 'while)
+ (unless (consp (cdr form))
+ (byte-compile-warn "too few arguments for `while'"))
+ (cons fn
+ (cons (byte-optimize-form (cadr form) nil)
+ (byte-optimize-body (cddr form) t))))
+
((eq fn 'interactive)
(byte-compile-warn "misplaced interactive spec: `%s'"
(prin1-to-string form))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 1ba5b64: Optimise 'while' bodies for effect,
Mattias Engdegård <=