mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
asyncmacro produces 'owned' types
This commit is contained in:
@@ -297,7 +297,7 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
||||
# -> complete(retFuture)
|
||||
procBody.add(newCall(newIdentNode("complete"), retFutureSym))
|
||||
|
||||
var closureIterator = newProc(iteratorNameSym, [newIdentNode("FutureBase")],
|
||||
var closureIterator = newProc(iteratorNameSym, [parseExpr("owned(FutureBase)")],
|
||||
procBody, nnkIteratorDef)
|
||||
closureIterator.pragma = newNimNode(nnkPragma, lineInfoFrom=prc.body)
|
||||
closureIterator.addPragma(newIdentNode("closure"))
|
||||
@@ -326,7 +326,7 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
||||
# Add discardable pragma.
|
||||
if returnType.kind == nnkEmpty:
|
||||
# Add Future[void]
|
||||
result.params[0] = parseExpr("Future[void]")
|
||||
result.params[0] = parseExpr("owned(Future[void])")
|
||||
if procBody.kind != nnkEmpty:
|
||||
result.body = outerProcBody
|
||||
#echo(treeRepr(result))
|
||||
|
||||
Reference in New Issue
Block a user