diff options
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: |