blob: 34ef97b8bf9e3e6b786692a9e8d05a1f90e2f12c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
discard """
disabled: true
output: '''
x
e
'''
"""
import asyncjs
# demonstrate forward definition
# for js
proc y(e: int): Future[string] {.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.} =
if e > 0:
return await y(0)
else:
return "x"
discard x(2)
|