From 869b2971ec30bab838550b6a7bac27e8d05cba36 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 8 Mar 2023 07:28:28 -0700 Subject: [PATCH] Fix a case of macroExpandOnly --- src/kiss/Kiss.hx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/kiss/Kiss.hx b/src/kiss/Kiss.hx index d5fbe3c..4e30ff0 100644 --- a/src/kiss/Kiss.hx +++ b/src/kiss/Kiss.hx @@ -465,14 +465,14 @@ class Kiss { public static function readerExpToHaxeExpr(exp, k): Expr { return switch (macroExpandAndConvert(exp, k, false)) { case Right(expr): expr; - default: throw "macroExpandAndConvert is broken"; + case e: throw 'macroExpandAndConvert is broken: ${e}'; }; } public static function macroExpand(exp, k):ReaderExp { return switch (macroExpandAndConvert(exp, k, true)) { case Left(exp): exp; - default: throw "macroExpandAndConvert is broken"; + case e: throw 'macroExpandAndConvert is broken: ${e}'; }; } @@ -570,7 +570,9 @@ class Kiss { var expanded = macros[mac](exp, args.copy(), k); if (expanded != null) { convert(expanded); - } else { + } else if (macroExpandOnly) { + Left(None.withPosOf(exp)); + } else{ Right(none); }; case CallExp({pos: _, def: Symbol(specialForm)}, args) if (specialForms.exists(specialForm) && !macroExpandOnly):