summary refs log tree commit diff stats
path: root/lib/pure/asyncmacro.nim
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2017-12-22 21:14:27 +0000
committerDominik Picheta <dominikpicheta@gmail.com>2017-12-27 22:37:11 +0000
commit52cc925e0e34580403b1a405ec8b4fa44c844de5 (patch)
treeef96f547e0d8975133a1ad1a0373285bbe9ab45e /lib/pure/asyncmacro.nim
parent7937e38423ee77100d99e84d4710edd6d9ec93ec (diff)
downloadNim-52cc925e0e34580403b1a405ec8b4fa44c844de5.tar.gz
Fixes #6100.
Diffstat (limited to 'lib/pure/asyncmacro.nim')
-rw-r--r--lib/pure/asyncmacro.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim
index a8e378d5c..35523702d 100644
--- a/lib/pure/asyncmacro.nim
+++ b/lib/pure/asyncmacro.nim
@@ -32,6 +32,12 @@ template createCb(retFutureSym, iteratorNameSym,
     try:
       if not nameIterVar.finished:
         var next = nameIterVar()
+        # Continue while the yielded future is already finished.
+        while (not next.isNil) and next.finished:
+          next = nameIterVar()
+          if nameIterVar.finished:
+            break
+
         if next == nil:
           if not retFutureSym.finished:
             let msg = "Async procedure ($1) yielded `nil`, are you await'ing a " &