From 9a19cc8083c67a4187268fa42bbfeccb8d75f32a Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 15 Feb 2024 18:09:04 -0700 Subject: [PATCH] Errors print but don't stop compilation until generation. --- src/kiss/Kiss.hx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/kiss/Kiss.hx b/src/kiss/Kiss.hx index a730411..edfe5b1 100644 --- a/src/kiss/Kiss.hx +++ b/src/kiss/Kiss.hx @@ -250,7 +250,9 @@ class Kiss { throw EExpected(expectedError); case null: printErr(); - Sys.exit(1); + Context.onGenerate((types) -> { + Sys.exit(1); + }); return null; default: printErr(); @@ -265,7 +267,9 @@ class Kiss { throw EExpected(expectedError); case null: printErr(); - Sys.exit(1); + Context.onGenerate((types) -> { + Sys.exit(1); + }); return null; default: printErr(); @@ -281,7 +285,9 @@ class Kiss { throw EExpected(expectedError); case null: printErr(); - Sys.exit(1); + Context.onGenerate((types) -> { + Sys.exit(1); + }); return null; default: printErr(); @@ -523,7 +529,7 @@ class Kiss { // readerExpToHaxeExpr must be called to process readermacro, alias, and macro definitions macroUsed = false; - var expr = readerExpToHaxeExpr(nextExp, k); + var expr = _try(()->readerExpToHaxeExpr(nextExp, k)); // exps in the loaded file that actually become haxe expressions can be inserted into the // file that loaded them at the position (load) was called. @@ -534,7 +540,7 @@ class Kiss { // cause double-evaluation of field forms if (loadAllExps) { loadedExps.push(nextExp); - } else if (!isEmpty(expr)) { + } else if (expr != null && !isEmpty(expr)) { // don't double-compile macros: if (macroUsed) { loadedExps.push(RawHaxe(expr.toString()).withPosOf(nextExp));