aboutsummaryrefslogtreecommitdiff
path: root/src/util.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-11 12:54:44 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-11 12:54:44 -0700
commit5926ae1f68d85a6805b8887ba09d81cd16fd69c2 (patch)
treeb34bf0c93937d749ae45e2ab8531fc20febfb8a5 /src/util.lisp
parent3a2b47ce43f6651b65d009532b3eec1a4bb002c4 (diff)
downloadconsfigurator-5926ae1f68d85a6805b8887ba09d81cd16fd69c2.tar.gz
move MACROEXPAND-ALL to utils.lisp
Pure code motion. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
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