diff options
author | Araq <rumpf_a@web.de> | 2017-12-27 10:34:31 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-12-27 10:34:31 +0100 |
commit | b3732e23716166dfa7c77e8dc1ee9b4571853aed (patch) | |
tree | 39ad24fd1b3a69ce74d4e4a68c242d6d18f04c64 /tests/js/tasync.nim | |
parent | 5c08092b88c0b6399c52804fd6f2c1fc92c58a86 (diff) | |
parent | 53cf0b2c24e5adc4fa99e49ddf1834991d663846 (diff) | |
download | Nim-b3732e23716166dfa7c77e8dc1ee9b4571853aed.tar.gz |
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'tests/js/tasync.nim')
-rw-r--r-- | tests/js/tasync.nim | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/js/tasync.nim b/tests/js/tasync.nim index a164827d2..34ef97b8b 100644 --- a/tests/js/tasync.nim +++ b/tests/js/tasync.nim @@ -1,8 +1,8 @@ discard """ disabled: true output: ''' -0 x +e ''' """ @@ -10,16 +10,22 @@ import asyncjs # demonstrate forward definition # for js -proc y(e: int): Future[string] +proc y(e: int): Future[string] {.async.} -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" - + if e > 0: + return await y(0) + else: + return "x" discard x(2) |