From d8b0ba143530e09b5a58cea1fe6fe41d60e654a6 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sun, 25 Jul 2021 22:08:21 -0600 Subject: [PATCH] fix double-evaluation of macros in automatic main function --- src/kiss/Kiss.hx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kiss/Kiss.hx b/src/kiss/Kiss.hx index df44f4a..1b5f339 100644 --- a/src/kiss/Kiss.hx +++ b/src/kiss/Kiss.hx @@ -223,8 +223,11 @@ class Kiss { } // When calling from build(), we can't add all expressions to the (begin) returned by (load), because that will // cause double-evaluation of field forms - if (loadAllExps || !isEmpty(expr)) { + if (loadAllExps) { loadedExps.push(nextExp); + } else if (!isEmpty(expr)) { + // don't double-compile macros: + loadedExps.push(RawHaxe(expr.toString()).withPosOf(nextExp)); } });