aboutsummaryrefslogtreecommitdiff
path: root/src/util.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.lisp')
-rw-r--r--src/util.lisp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util.lisp b/src/util.lisp
index ee4ea71..248f52a 100644
--- a/src/util.lisp
+++ b/src/util.lisp
@@ -41,6 +41,19 @@
(defun memstring= (string list)
(member string list :test #'string=))
+(defun macroexpand-all (form &optional env)
+ "Wrap TRIVIAL-MACROEXPAND-ALL:MACROEXPAND-ALL to convert silent failures to
+expand into errors."
+ (multiple-value-bind (expanded supported env-supported)
+ (trivial-macroexpand-all:macroexpand-all form env)
+ (cond
+ ((not supported)
+ (error "Don't know how to MACROEXPAND-ALL in this Lisp."))
+ ((and env (not env-supported))
+ (error "Don't know how to MACROEXPAND-ALL with env in this Lisp."))
+ (t
+ expanded))))
+
;;;; Version numbers