Merge pull request #9167 from LemonBoy/fix-asyncmacro-regression

Fix regression w/ templates defined in async proc
This commit is contained in:
Andreas Rumpf 2018-10-03 19:20:33 +02:00 • committed by GitHub
commit 6e09f40c4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -177,7 +177,7 @@ proc processBody(node, retFutureSym: NimNode,
var newDiscard = node
result.createVar("futureDiscard_" & $toStrLit(node[0][1]), node[0][1],
newDiscard[0], newDiscard, node)
of RoutineNodes:
of RoutineNodes-{nnkTemplateDef}:
# skip all the nested procedure definitions
return
else: discard

View file

@ -0,0 +1,11 @@
discard """
output: 42
"""
import asyncdispatch
proc foo(): Future[int] {.async.} =
template ret() = return 42
ret()
echo (waitFor foo())