Make asyncjs Future[void] play nicely with last line discardable calls
This commit is contained in:
parent
85ac3130aa
commit
7f6afa9e9b
2 changed files with 36 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ discard """
|
|||
output: '''
|
||||
0
|
||||
x
|
||||
e
|
||||
'''
|
||||
"""
|
||||
|
||||
|
|
@ -12,15 +13,19 @@ import asyncjs
|
|||
# for js
|
||||
proc y(e: int): Future[string]
|
||||
|
||||
proc x(e: int) {.async.} =
|
||||
proc e: int {.discardable.} =
|
||||
echo "e"
|
||||
return 2
|
||||
|
||||
proc x(e: int): Future[void] {.async.} =
|
||||
var s = await y(e)
|
||||
echo s
|
||||
e()
|
||||
|
||||
proc y(e: int): Future[string] {.async.} =
|
||||
echo 0
|
||||
return "x"
|
||||
|
||||
|
||||
|
||||
discard x(2)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue