diff options
author | Araq <rumpf_a@web.de> | 2020-03-17 11:22:20 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2020-03-17 18:00:11 +0100 |
commit | b737bb4be0956f8dce69ec8b7ccfe624890abaa5 (patch) | |
tree | 059ab5a992c4fb2341473b35c9f55121eed42a17 /lib/std/with.nim | |
parent | 35d14095edcb530535a3f2b7e7e759c0f993e2c9 (diff) | |
download | Nim-b737bb4be0956f8dce69ec8b7ccfe624890abaa5.tar.gz |
fixes a bug for 'dup' and 'with'; they can now handle nested statement lists that can result from macros
Diffstat (limited to 'lib/std/with.nim')
-rw-r--r-- | lib/std/with.nim | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/std/with.nim b/lib/std/with.nim index 1dfb67c2e..c1ac96fcb 100644 --- a/lib/std/with.nim +++ b/lib/std/with.nim @@ -35,14 +35,7 @@ macro with*(arg: typed; calls: varargs[untyped]): untyped = doAssert a == 43 result = newNimNode(nnkStmtList, arg) - expectKind calls, nnkArgList - let body = - if calls.len == 1 and calls[0].kind in {nnkStmtList, nnkStmtListExpr}: - calls[0] - else: - calls - for call in body: - result.add underscoredCall(call, arg) + underscoredCalls(result, calls, arg) when isMainModule: type |