From 1e0981706e346f0c2dc1b36989dade17c1b80415 Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Mon, 5 Mar 1990 12:18:19 +0000 Subject: [PATCH] Defined PREPROCESSOR-MACROEXPAND. This function correctly macroexpands top-level forms in the bootstrapping environment (MACROEXPAND doesn't to the trick.) --- compiler/main.lisp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/compiler/main.lisp b/compiler/main.lisp index 69f1f123e..b0812f4da 100644 --- a/compiler/main.lisp +++ b/compiler/main.lisp @@ -729,6 +729,26 @@ (process-form form tlf-num object))) +;;; PREPROCESSOR-MACROEXPAND -- Internal +;;; +;;; Macroexpand form in the current environment with an error handler. +;;; +(defun preprocessor-macroexpand (form) + (handler-case #+new-compiler (macroexpand form *fenv*) + #-new-compiler + (if (consp form) + (let* ((name (car form)) + (exp (or (cddr (assoc name *fenv*)) + (info function macro-function name)))) + (if exp + (funcall exp form *fenv*) + form)) + form) + (error (condition) + (compiler-error "(during macroexpansion)~%~A" + condition)))) + + (proclaim '(special *compiler-error-bailout*)) ;;; PROCESS-FORM -- Internal @@ -750,11 +770,7 @@ ',form) tlf-num object) (throw 'process-form-error-abort nil))) - (form - (handler-case (macroexpand form *fenv*) - (error (condition) - (compiler-error "(during macroexpansion)~%~A" - condition))))) + (form (preprocessor-macroexpand form))) (if (atom form) (convert-and-maybe-compile form tlf-num object) (case (car form) -- GitLab