diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2021-07-29 15:35:55 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2021-07-30 09:54:30 +0200 |
commit | 52a55e11deb7822c67a8d7e6f2544b8f41d25a4e (patch) | |
tree | 0054a11e914e09d5dc775a6c07585c73c1cf0e35 /lisp/emacs-lisp/easy-mmode.el | |
parent | ab9c06449df4c4c58d586573003de419199cc1be (diff) | |
download | emacs-52a55e11deb7822c67a8d7e6f2544b8f41d25a4e.tar.gz emacs-52a55e11deb7822c67a8d7e6f2544b8f41d25a4e.tar.bz2 emacs-52a55e11deb7822c67a8d7e6f2544b8f41d25a4e.zip |
Optimise let and let* whose body is constant or the last variable
Simplify (let ((X1 E1) ... (Xn En)) Xn)
=> (progn E1 ... En)
and (let* ((X1 E1) ... (Xn En)) Xn)
=> (let* ((X1 E1) ... (Xn-1 En-1)) En)
and similarly the case where the body is a constant, extending a
previous optimisation that only applied to the constant nil.
This reduces the number of bound variables, shortens the code, and
enables further optimisations.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-letX): Rewrite using
`pcase` and add the aforementioned transformations.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test cases.
Diffstat (limited to 'lisp/emacs-lisp/easy-mmode.el')
0 files changed, 0 insertions, 0 deletions