summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/macroexp.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-12-20 13:21:36 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2023-12-21 13:20:27 +0100
commit57fd0f47f6955505195f77a55d29334ded88889c (patch)
tree0d4d80084b46e3749dabec56dc8ee75b90ea45f0 /lisp/emacs-lisp/macroexp.el
parent14ecc377ab43e4c33506c2a8b65bf1e75fb262d3 (diff)
downloademacs-57fd0f47f6955505195f77a55d29334ded88889c.tar.gz
emacs-57fd0f47f6955505195f77a55d29334ded88889c.tar.bz2
emacs-57fd0f47f6955505195f77a55d29334ded88889c.zip
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.
Diffstat (limited to 'lisp/emacs-lisp/macroexp.el')
-rw-r--r--lisp/emacs-lisp/macroexp.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 615a6622ce6..2a646be9725 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -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)