From 30f152239f54d3f07325db59f7950ed252af751c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Fri, 30 Aug 2013 20:56:32 +0200 Subject: [PATCH] Convert toplevel macroexpands its input --- src/compiler/compiler.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/compiler.lisp b/src/compiler/compiler.lisp index 0ec5fea..ebf22a5 100644 --- a/src/compiler/compiler.lisp +++ b/src/compiler/compiler.lisp @@ -600,8 +600,8 @@ (when (find :compile-toplevel situations) (eval (cons 'progn body))) ;; `load-toplevel' is given, then just compile the subforms as usual. - (if (find :load-toplevel situations) - (convert `(progn ,@body)))) + (when (find :load-toplevel situations) + (convert `(progn ,@body)))) ((find :execute situations) (convert `(progn ,@body) *multiple-value-p*)) (t @@ -1431,6 +1431,11 @@ (subseq string 0 n))) (defun convert-toplevel (sexp &optional multiple-value-p) + ;; Macroexpand sexp as much as possible + (multiple-value-bind (sexp expandedp) (!macroexpand-1 sexp) + (when expandedp + (return-from convert-toplevel (convert-toplevel sexp multiple-value-p)))) + ;; Process as toplevel (let ((*toplevel-compilations* nil)) (cond ;; Non-empty toplevel progn -- 1.7.10.4