async: removed the 'unown' references, async never worked with --newruntime anyway and --newruntime is dead (#15374)
This commit is contained in:
parent
cdac67376c
commit
04cecdf9c2
2 changed files with 9 additions and 9 deletions
|
|
@ -14,21 +14,20 @@ import macros, strutils, asyncfutures
|
||||||
template createCb(retFutureSym, iteratorNameSym,
|
template createCb(retFutureSym, iteratorNameSym,
|
||||||
strName, identName, futureVarCompletions: untyped) =
|
strName, identName, futureVarCompletions: untyped) =
|
||||||
bind finished
|
bind finished
|
||||||
let retFutUnown = unown retFutureSym
|
|
||||||
|
|
||||||
var nameIterVar = iteratorNameSym
|
var nameIterVar = iteratorNameSym
|
||||||
proc identName {.closure.} =
|
proc identName {.closure.} =
|
||||||
try:
|
try:
|
||||||
if not nameIterVar.finished:
|
if not nameIterVar.finished:
|
||||||
var next = unown nameIterVar()
|
var next = nameIterVar()
|
||||||
# Continue while the yielded future is already finished.
|
# Continue while the yielded future is already finished.
|
||||||
while (not next.isNil) and next.finished:
|
while (not next.isNil) and next.finished:
|
||||||
next = unown nameIterVar()
|
next = nameIterVar()
|
||||||
if nameIterVar.finished:
|
if nameIterVar.finished:
|
||||||
break
|
break
|
||||||
|
|
||||||
if next == nil:
|
if next == nil:
|
||||||
if not retFutUnown.finished:
|
if not retFutureSym.finished:
|
||||||
let msg = "Async procedure ($1) yielded `nil`, are you await'ing a " &
|
let msg = "Async procedure ($1) yielded `nil`, are you await'ing a " &
|
||||||
"`nil` Future?"
|
"`nil` Future?"
|
||||||
raise newException(AssertionDefect, msg % strName)
|
raise newException(AssertionDefect, msg % strName)
|
||||||
|
|
@ -39,12 +38,12 @@ template createCb(retFutureSym, iteratorNameSym,
|
||||||
{.pop.}
|
{.pop.}
|
||||||
except:
|
except:
|
||||||
futureVarCompletions
|
futureVarCompletions
|
||||||
if retFutUnown.finished:
|
if retFutureSym.finished:
|
||||||
# Take a look at tasyncexceptions for the bug which this fixes.
|
# Take a look at tasyncexceptions for the bug which this fixes.
|
||||||
# That test explains it better than I can here.
|
# That test explains it better than I can here.
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
retFutUnown.fail(getCurrentException())
|
retFutureSym.fail(getCurrentException())
|
||||||
identName()
|
identName()
|
||||||
|
|
||||||
proc createFutureVarCompletions(futureVarIdents: seq[NimNode],
|
proc createFutureVarCompletions(futureVarIdents: seq[NimNode],
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,10 @@ proc nimTraceRefDyn(q: pointer; env: pointer) {.compilerRtl, inline.} =
|
||||||
j.traceStack.add(head p[], cast[ptr PNimTypeV2](p[])[])
|
j.traceStack.add(head p[], cast[ptr PNimTypeV2](p[])[])
|
||||||
|
|
||||||
template orcAssert(cond, msg) =
|
template orcAssert(cond, msg) =
|
||||||
if not cond:
|
when logOrc:
|
||||||
cfprintf(cstderr, "[Bug!] %s\n", msg)
|
if not cond:
|
||||||
quit 1
|
cfprintf(cstderr, "[Bug!] %s\n", msg)
|
||||||
|
quit 1
|
||||||
|
|
||||||
var
|
var
|
||||||
roots {.threadvar.}: CellSeq
|
roots {.threadvar.}: CellSeq
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue