Helpful error messages for macro expansion errors

This commit is contained in:
2021-10-28 13:39:05 -04:00
parent 78cb9900d7
commit c7ccbf8685
2 changed files with 6 additions and 3 deletions

View File

@@ -283,7 +283,6 @@ class Kiss {
// Bind the table arguments of this function for easy recursive calling/passing
var convert = readerExpToHaxeExpr.bind(_, k);
var none = EBlock([]).withMacroPosOf(exp);
var expr = switch (exp.def) {

View File

@@ -453,8 +453,12 @@ class Macros {
args[innerArgNames.shift()] = restArgs;
}
// Return the macro expansion:
return Helpers.runAtCompileTime(b.callSymbol("begin", exps.slice(2)), k, args);
try {
// Return the macro expansion:
return Helpers.runAtCompileTime(b.callSymbol("begin", exps.slice(2)), k, args);
} catch (error) {
throw CompileError.fromExp(wholeExp, 'Macro expansion error: $error');
};
};
null;