From c01b66b2a133a4a614799337477cfb883fafa23b Mon Sep 17 00:00:00 2001 From: Nickolay Bukreyev Date: Mon, 6 Mar 2023 03:31:17 +0700 Subject: [PATCH] Add more comments to the code --- letUtils.nim | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/letUtils.nim b/letUtils.nim index c3eb20c..241143d 100644 --- a/letUtils.nim +++ b/letUtils.nim @@ -116,22 +116,22 @@ macro freezeVars*(body: untyped): auto = validate thing ]## - let letTuple = nnkVarTuple.newNimNode - let varTupleConstr = nnkTupleConstr.newNimNode + let letTuple = nnkVarTuple.newNimNode # To be assigned outside `body`. + let varTupleConstr = nnkTupleConstr.newNimNode # Forwarded from inside. func recurse(body: NimNode) = for node in body: - case node.kind - of nnkVarSection: - for defs in node: - for i in 0 ..< defs.len - 2: - let varIdent = defs[i] - letTuple.add varIdent - varTupleConstr.add varIdent - of nnkStmtList: - node.recurse - else: - discard + case node.kind: + of nnkVarSection: + for defs in node: + for i in 0 ..< defs.len - 2: + let varIdent = defs[i] + letTuple.add varIdent + varTupleConstr.add varIdent + of nnkStmtList: # `body` can have nested statement lists if was generated by a macro. + node.recurse + else: + discard body.expectKind nnkStmtList body.recurse