mirror of
https://github.com/status-im/nim-stew.git
synced 2025-02-13 12:36:57 +00:00
Add macros.genCode
This commit is contained in:
parent
4f4f138fb4
commit
f782f0378f
@ -264,3 +264,13 @@ macro unpackArgs*(callee: typed, args: untyped): untyped =
|
||||
else:
|
||||
result.add arg
|
||||
|
||||
template genCode*(body: untyped) =
|
||||
iterator generator: NimNode = body
|
||||
|
||||
macro payload: untyped =
|
||||
result = newStmtList()
|
||||
for node in generator():
|
||||
result.add node
|
||||
|
||||
payload()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user