Fix regression w/ templates defined in async proc
This commit is contained in:
parent
91c13a0163
commit
2c0bfb34fd
2 changed files with 12 additions and 1 deletions
|
|
@ -177,7 +177,7 @@ proc processBody(node, retFutureSym: NimNode,
|
||||||
var newDiscard = node
|
var newDiscard = node
|
||||||
result.createVar("futureDiscard_" & $toStrLit(node[0][1]), node[0][1],
|
result.createVar("futureDiscard_" & $toStrLit(node[0][1]), node[0][1],
|
||||||
newDiscard[0], newDiscard, node)
|
newDiscard[0], newDiscard, node)
|
||||||
of RoutineNodes:
|
of RoutineNodes-{nnkTemplateDef}:
|
||||||
# skip all the nested procedure definitions
|
# skip all the nested procedure definitions
|
||||||
return
|
return
|
||||||
else: discard
|
else: discard
|
||||||
|
|
|
||||||
11
tests/async/ttemplateinasync.nim
Normal file
11
tests/async/ttemplateinasync.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
discard """
|
||||||
|
output: 42
|
||||||
|
"""
|
||||||
|
|
||||||
|
import asyncdispatch
|
||||||
|
|
||||||
|
proc foo(): Future[int] {.async.} =
|
||||||
|
template ret() = return 42
|
||||||
|
ret()
|
||||||
|
|
||||||
|
echo (waitFor foo())
|
||||||
Loading…
Add table
Add a link
Reference in a new issue