1 # Helper to print an int32 in decimal. 2 3 == code 4 # instruction effective address register displacement immediate 5 # . op subop mod rm32 base index scale r32 6 # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes 7 8 print-int32-decimal: # out : (address stream), n : int32 9 # works by generating characters from lowest to highest and pushing them 10 # to the stack, before popping them one by one into the stream 11 # 12 # pseudocode: 13 # push sentinel 14 # eax = abs(n) 15 # while true 16 # sign-extend eax into edx 17 # eax, edx = eax/10, eax%10 18discard """ output: ''' @[1, 2, 3, 4] 123 ''' """ # bug #5314, bug #6626 import asyncdispatch proc bar(i: int): Future[int] {.async.} = await sleepAsync(2) result = i proc foo(): Future[seq[int]] {.async.} = await sleepAsync(2) result = @[1, 2, await bar(3), 4] # <--- The bug is here proc foo2() {.async.} = await sleepAsync(2) echo(await bar(1), await bar(2), await bar(3)) echo waitFor foo() waitFor foo2()