summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-07-15 10:56:20 +0200
committerAraq <rumpf_a@web.de>2019-07-15 10:56:55 +0200
commitedbe02b4e1f028aa3c26f9a1145c25c33a7f5cae (patch)
treec6d5cf90b2f058df6cbc4e6c6b26146798a191f1 /lib
parentdf53c68a363318c9ce080b6827b573a3d60ec760 (diff)
downloadNim-edbe02b4e1f028aa3c26f9a1145c25c33a7f5cae.tar.gz
newruntime: progress to make 'async' work with --newruntime
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/asyncmacro.nim11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/pure/asyncmacro.nim b/lib/pure/asyncmacro.nim
index fde7fe59a..477011285 100644
--- a/lib/pure/asyncmacro.nim
+++ b/lib/pure/asyncmacro.nim
@@ -25,9 +25,9 @@ proc skipStmtList(node: NimNode): NimNode {.compileTime.} =
 template createCb(retFutureSym, iteratorNameSym,
                   strName, identName, futureVarCompletions: untyped) =
   bind finished
+  let retFutUnown = unown retFutureSym
 
   var nameIterVar = iteratorNameSym
-  #{.push stackTrace: off.}
   proc identName {.closure.} =
     try:
       if not nameIterVar.finished:
@@ -39,7 +39,7 @@ template createCb(retFutureSym, iteratorNameSym,
             break
 
         if next == nil:
-          if not retFutureSym.finished:
+          if not retFutUnown.finished:
             let msg = "Async procedure ($1) yielded `nil`, are you await'ing a " &
                     "`nil` Future?"
             raise newException(AssertionError, msg % strName)
@@ -50,16 +50,13 @@ template createCb(retFutureSym, iteratorNameSym,
             {.pop.}
     except:
       futureVarCompletions
-
-      if retFutureSym.finished:
+      if retFutUnown.finished:
         # Take a look at tasyncexceptions for the bug which this fixes.
         # That test explains it better than I can here.
         raise
       else:
-        retFutureSym.fail(getCurrentException())
-
+        retFutUnown.fail(getCurrentException())
   identName()
-  #{.pop.}
 
 template useVar(result: var NimNode, futureVarNode: NimNode, valueReceiver,
                 rootReceiver: untyped, fromNode: NimNode) =