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.
This commit is contained in:
parent
af085ef40b
commit
1ba5b64dd1
1 changed files with 7 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue