-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Using the following import statement
import asyncioGives the following build error
c:\test\nimcache\asyncio.c:1183:4: error: 'else' without a previous 'if'
else {
^
The asyncio.c line the compiler complains about is the following
popSafePoint();
}
F.len-=1; // 1182
else { // 1183
popSafePoint();As you can see, the compiler inputs "F.len-=1" between the end of an "if" clause and the beginning of "else", making the source code file invalid. The reason seem to be the try/catch on line 236-251 in asyncio.nim (https://github.com/Araq/Nimrod/blob/devel/lib/pure/asyncio.nim#L236)
I tried removing the try/catch in asyncio.nim leaving me with the following code on line 235-247
let sock = PAsyncSocket(h)
let bytesSent = sock.socket.sendAsync(sock.sendBuffer)
if bytesSent == 0:
# Apparently the socket cannot be written to. Even though select
# just told us that it can be... This used to be an assert. Just
# do nothing instead.
elif bytesSent != sock.sendBuffer.len:
sock.sendBuffer = sock.sendBuffer[bytesSent .. -1]
elif bytesSent == sock.sendBuffer.len:
sock.sendBuffer = ""
if PAsyncSocket(h).handleWrite != nil:
PAsyncSocket(h).handleWrite(PAsyncSocket(h))... and it compiles.
Notes: Tried with Nimrod 0.9.4 (32bit) on Windows 8 x64.