From fe85c150607e9da2f15522418f55d3a4a22382f0 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 23 Jun 2021 13:28:45 -0600 Subject: [PATCH] fix regression in defun/defmethod --- src/kiss/Helpers.hx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kiss/Helpers.hx b/src/kiss/Helpers.hx index 9923750..09dd481 100644 --- a/src/kiss/Helpers.hx +++ b/src/kiss/Helpers.hx @@ -152,11 +152,13 @@ class Helpers { var expr = if (body.length == 0) { EReturn(null).withMacroPosOf(if (name != null) name else argList); } else { - k.convert(CallExp(Symbol("begin").withPos(body[0].pos), body).withPos(body[0].pos)); - } + var block = k.convert(CallExp(Symbol("begin").withPos(body[0].pos), body).withPos(body[0].pos)); - if (returnsValue) { - expr = EReturn(expr).withMacroPosOf(body[-1]); + if (returnsValue) { + EReturn(block).withMacroPosOf(body[-1]); + } else { + block; + }; } // To make function args immutable by default, we would use (let...) instead of (begin...)