Fix the forward test
This commit is contained in:
parent
b3dfc93bee
commit
7b495e23d4
1 changed files with 5 additions and 4 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
disabled: true
|
disabled: true
|
||||||
output: '''
|
output: '''
|
||||||
0
|
|
||||||
x
|
x
|
||||||
e
|
e
|
||||||
'''
|
'''
|
||||||
|
|
@ -11,7 +10,7 @@ import asyncjs
|
||||||
|
|
||||||
# demonstrate forward definition
|
# demonstrate forward definition
|
||||||
# for js
|
# for js
|
||||||
proc y(e: int): Future[string]
|
proc y(e: int): Future[string] {.async.}
|
||||||
|
|
||||||
proc e: int {.discardable.} =
|
proc e: int {.discardable.} =
|
||||||
echo "e"
|
echo "e"
|
||||||
|
|
@ -23,7 +22,9 @@ proc x(e: int): Future[void] {.async.} =
|
||||||
e()
|
e()
|
||||||
|
|
||||||
proc y(e: int): Future[string] {.async.} =
|
proc y(e: int): Future[string] {.async.} =
|
||||||
echo 0
|
if e > 0:
|
||||||
|
return await y(0)
|
||||||
|
else:
|
||||||
return "x"
|
return "x"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue