Make asyncjs Future[void] play nicely with last line discardable calls

This commit is contained in:
Alexander Ivanov 2017-12-19 13:57:37 +02:00
commit 7f6afa9e9b
2 changed files with 36 additions and 5 deletions

View file

@ -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)