Maintain byte-compile-form-stack in cconv-convert (bug#67483)

* lisp/emacs-lisp/macroexp.el (macroexp--with-extended-form-stack):
New.
* lisp/emacs-lisp/cconv.el (cconv-closure-convert, cconv-convert):
Push forms onto byte-compile-form-stack.
This commit is contained in:
Mattias Engdegård 2023-12-20 13:21:36 +01:00
parent 14ecc377ab
commit 57fd0f47f6
2 changed files with 16 additions and 2 deletions

View file

@ -39,6 +39,18 @@ of `byte-compile-form', etc., and manually popped off at its end.
This is to preserve the data in it in the event of a
condition-case handling a signaled error.")
(defmacro macroexp--with-extended-form-stack (expr &rest body)
"Evaluate BODY with EXPR pushed onto `byte-compile-form-stack'."
(declare (indent 1))
;; FIXME: We really should just be using a simple dynamic let-binding here,
;; but these explicit push and pop make the extended stack value visible
;; to error handlers. Remove that need for that!
`(progn
(push ,expr byte-compile-form-stack)
(prog1
(progn ,@body)
(pop byte-compile-form-stack))))
;; Bound by the top-level `macroexpand-all', and modified to include any
;; macros defined by `defmacro'.
(defvar macroexpand-all-environment nil)