fixes #1970
This commit is contained in:
parent
d4573f1762
commit
67b024838c
2 changed files with 39 additions and 29 deletions
|
|
@ -1872,6 +1872,8 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
||||||
# -> complete(retFuture, result)
|
# -> complete(retFuture, result)
|
||||||
var iteratorNameSym = genSym(nskIterator, $prc[0].getName & "Iter")
|
var iteratorNameSym = genSym(nskIterator, $prc[0].getName & "Iter")
|
||||||
var procBody = prc[6].processBody(retFutureSym, subtypeIsVoid, nil)
|
var procBody = prc[6].processBody(retFutureSym, subtypeIsVoid, nil)
|
||||||
|
# don't do anything with forward bodies (empty)
|
||||||
|
if procBody.kind != nnkEmpty:
|
||||||
if not subtypeIsVoid:
|
if not subtypeIsVoid:
|
||||||
procBody.insert(0, newNimNode(nnkPragma).add(newIdentNode("push"),
|
procBody.insert(0, newNimNode(nnkPragma).add(newIdentNode("push"),
|
||||||
newNimNode(nnkExprColonExpr).add(newNimNode(nnkBracketExpr).add(
|
newNimNode(nnkExprColonExpr).add(newNimNode(nnkBracketExpr).add(
|
||||||
|
|
@ -1917,9 +1919,8 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
||||||
if returnType.kind == nnkEmpty:
|
if returnType.kind == nnkEmpty:
|
||||||
# Add Future[void]
|
# Add Future[void]
|
||||||
result[3][0] = parseExpr("Future[void]")
|
result[3][0] = parseExpr("Future[void]")
|
||||||
|
if procBody.kind != nnkEmpty:
|
||||||
result[6] = outerProcBody
|
result[6] = outerProcBody
|
||||||
|
|
||||||
#echo(treeRepr(result))
|
#echo(treeRepr(result))
|
||||||
#if prc[0].getName == "testInfix":
|
#if prc[0].getName == "testInfix":
|
||||||
# echo(toStrLit(result))
|
# echo(toStrLit(result))
|
||||||
|
|
|
||||||
9
tests/async/tasync_forward.nim
Normal file
9
tests/async/tasync_forward.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
import asyncdispatch
|
||||||
|
|
||||||
|
# bug #1970
|
||||||
|
|
||||||
|
proc foo {.async.}
|
||||||
|
|
||||||
|
proc foo {.async.} =
|
||||||
|
discard
|
||||||
Loading…
Add table
Add a link
Reference in a new issue