mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-11 09:20:51 +00:00
Normalise nested progn
forms in byte-code optimiser
* lisp/emacs-lisp/byte-opt.el (byte-optimize-body): Flatten body. This simplifies the source tree and reduces the number of different cases that other optimisations need to take into account.
This commit is contained in:
parent
bba48d6ee5
commit
c4724add00
@ -727,8 +727,12 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.")
|
||||
(while rest
|
||||
(setq fe (or all-for-effect (cdr rest)))
|
||||
(setq new (and (car rest) (byte-optimize-form (car rest) fe)))
|
||||
(if (or new (not fe))
|
||||
(setq result (cons new result)))
|
||||
(when (and (consp new) (eq (car new) 'progn))
|
||||
;; Flatten `progn' form into the body.
|
||||
(setq result (append (reverse (cdr new)) result))
|
||||
(setq new (pop result)))
|
||||
(when (or new (not fe))
|
||||
(setq result (cons new result)))
|
||||
(setq rest (cdr rest)))
|
||||
(nreverse result)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user