mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-29 00:31:01 -08:00
Encapsulate byte-compile-form-stack maintenance
* lisp/emacs-lisp/bytecomp.el (byte-compile-toplevel-file-form) (byte-compile-form): * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Use `macroexp--with-extended-form-stack` instead of explicit push and pop.
This commit is contained in:
parent
f34f474e38
commit
9db1fe638e
2 changed files with 120 additions and 127 deletions
|
|
@ -2663,16 +2663,12 @@ list that represents a doc string reference.
|
|||
|
||||
;; byte-hunk-handlers cannot call this!
|
||||
(defun byte-compile-toplevel-file-form (top-level-form)
|
||||
;; (let ((byte-compile-form-stack
|
||||
;; (cons top-level-form byte-compile-form-stack)))
|
||||
(push top-level-form byte-compile-form-stack)
|
||||
(prog1
|
||||
(macroexp--with-extended-form-stack top-level-form
|
||||
(byte-compile-recurse-toplevel
|
||||
top-level-form
|
||||
(lambda (form)
|
||||
(let ((byte-compile-current-form nil)) ; close over this for warnings.
|
||||
(byte-compile-file-form (byte-compile-preprocess form t)))))
|
||||
(pop byte-compile-form-stack)))
|
||||
(byte-compile-file-form (byte-compile-preprocess form t)))))))
|
||||
|
||||
;; byte-hunk-handlers can call this.
|
||||
(defun byte-compile-file-form (form)
|
||||
|
|
@ -3483,7 +3479,7 @@ lambda-expression."
|
|||
;;
|
||||
(defun byte-compile-form (form &optional for-effect)
|
||||
(let ((byte-compile--for-effect for-effect))
|
||||
(push form byte-compile-form-stack)
|
||||
(macroexp--with-extended-form-stack form
|
||||
(cond
|
||||
((not (consp form))
|
||||
(cond ((or (not (symbolp form)) (macroexp--const-symbol-p form))
|
||||
|
|
@ -3597,8 +3593,7 @@ lambda-expression."
|
|||
(byte-compile-unfold-bcf form))
|
||||
((byte-compile-normal-call form)))
|
||||
(if byte-compile--for-effect
|
||||
(byte-compile-discard))
|
||||
(pop byte-compile-form-stack)))
|
||||
(byte-compile-discard)))))
|
||||
|
||||
(let ((important-return-value-fns
|
||||
'(
|
||||
|
|
|
|||
|
|
@ -334,8 +334,7 @@ Only valid during macro-expansion."
|
|||
"Expand all macros in FORM.
|
||||
This is an internal version of `macroexpand-all'.
|
||||
Assumes the caller has bound `macroexpand-all-environment'."
|
||||
(push form byte-compile-form-stack)
|
||||
(prog1
|
||||
(macroexp--with-extended-form-stack form
|
||||
(if (eq (car-safe form) 'backquote-list*)
|
||||
;; Special-case `backquote-list*', as it is normally a macro that
|
||||
;; generates exceedingly deep expansions from relatively shallow input
|
||||
|
|
@ -520,8 +519,7 @@ Assumes the caller has bound `macroexpand-all-environment'."
|
|||
newform
|
||||
(macroexp--expand-all form)))
|
||||
(macroexp--expand-all newform))))))
|
||||
(_ form))))
|
||||
(pop byte-compile-form-stack)))
|
||||
(_ form))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun macroexpand-all (form &optional environment)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue