diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-06-19 06:08:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-19 15:08:00 +0200 |
commit | 2039e3e883ac42cd9b6012335a92564ca2b56387 (patch) | |
tree | f2e2238c0973b6927aca358aeac9752a1e58d0a1 /lib | |
parent | 65c7884a3c84d7e1750cf630940b089ed204bc1a (diff) | |
download | Nim-2039e3e883ac42cd9b6012335a92564ca2b56387.tar.gz |
fix #13899 defer now works with async (#14723)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/asyncmacro.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim index cbed6372c..621a4b00c 100644 --- a/lib/pure/asyncmacro.nim +++ b/lib/pure/asyncmacro.nim @@ -207,6 +207,9 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} = futureVarIdents) # don't do anything with forward bodies (empty) if procBody.kind != nnkEmpty: + # fix #13899, defer should not escape its original scope + procBody = newStmtList(newTree(nnkBlockStmt, newEmptyNode(), procBody)) + procBody.add(createFutureVarCompletions(futureVarIdents, nil)) if not subtypeIsVoid: |