Add macros.genCode

This commit is contained in:
Zahary Karadjov 2019-07-19 03:04:21 +03:00
parent 4f4f138fb4
commit f782f0378f
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609

View File

@ -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()