Skip to content

Commit

Permalink
Add more comments to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
SirNickolas committed Mar 5, 2023
1 parent 63d92e7 commit c01b66b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions letUtils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c01b66b

Please sign in to comment.