add enumerate macro (#15297)

* add `enumerate` macro

* address the comments

* put `enumerate` in its own module
This commit is contained in:
Miran 2020-09-22 13:08:36 +02:00 • committed by GitHub
commit 11c377c114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 5 deletions

View file

@ -335,6 +335,7 @@ macro collect*(init, body: untyped): untyped {.since: (1, 1).} =
call.add init[i]
result = newTree(nnkStmtListExpr, newVarStmt(res, call), resBody, res)
when isMainModule:
since (1, 1):
block dup_with_field: