Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # nim check -d=nimDumpAsync input.nim
- proc foo(): Future[void] =
- var retFuture259001 = newFuture[void]("foo")
- iterator fooIter259002(): FutureBase {.closure.} =
- echo "before await"
- var future259003 = newFuture[void]()
- yield future259003
- if future259003.failed:
- setCurrentException(future259003.error)
- if future259003.error of Exception:
- echo "Exception"
- elif true:
- echo "except"
- elif true:
- echo "finally"
- elif true:
- raise future259003.error
- setCurrentException(nil)
- else:
- try:
- future259003.read
- echo "after await"
- except Exception:
- echo "Exception"
- except:
- echo "except"
- finally:
- echo "finally"
- complete(retFuture259001)
- var nameIterVar259006 = fooIter259002
- proc foo_continue259004() {.closure.} =
- try:
- if notnameIterVar259006.finished:
- var next259008 = nameIterVar259006()
- if next259008 ==
- nil:
- if notretFuture259001.finished:
- let msg259010 = "Async procedure ($1) yielded `nil`, are you await\'ing a " &
- "`nil` Future?"
- raise newException(AssertionError, msg259010 % "foo")
- else:
- {.gcsafe.}:
- {.push, hint[ConvFromXtoItselfNotNeeded]: off.}
- next259008.callback = (proc () {.closure, gcsafe.})(foo_continue259004)
- {.pop.}
- except:
- if retFuture259001.finished:
- raise
- else:
- retFuture259001.fail(getCurrentException())
- foo_continue259004()
- return retFuture259001
Add Comment
Please, Sign In to add comment