[backport] run nimpretty on async
This commit is contained in:
parent
63bcbea700
commit
aa513d78e7
8 changed files with 61 additions and 57 deletions
|
|
@ -242,7 +242,8 @@ proc processRequest(
|
||||||
# - Check for Content-length header
|
# - Check for Content-length header
|
||||||
if request.headers.hasKey("Content-Length"):
|
if request.headers.hasKey("Content-Length"):
|
||||||
var contentLength = 0
|
var contentLength = 0
|
||||||
if parseSaturatedNatural(request.headers["Content-Length"], contentLength) == 0:
|
if parseSaturatedNatural(request.headers["Content-Length"],
|
||||||
|
contentLength) == 0:
|
||||||
await request.respond(Http400, "Bad Request. Invalid Content-Length.")
|
await request.respond(Http400, "Bad Request. Invalid Content-Length.")
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,8 @@ proc processBody(node, retFutureSym: NimNode,
|
||||||
if node[1][0].eqIdent("await"):
|
if node[1][0].eqIdent("await"):
|
||||||
# x = await y
|
# x = await y
|
||||||
var newAsgn = node
|
var newAsgn = node
|
||||||
result.createVar("future" & $node[0].toStrLit, node[1][1], newAsgn[1], newAsgn, node)
|
result.createVar("future" & $node[0].toStrLit, node[1][1], newAsgn[1],
|
||||||
|
newAsgn, node)
|
||||||
else: discard
|
else: discard
|
||||||
of nnkDiscardStmt:
|
of nnkDiscardStmt:
|
||||||
# discard await x
|
# discard await x
|
||||||
|
|
@ -300,7 +301,8 @@ proc asyncSingleProc(prc: NimNode): NimNode {.compileTime.} =
|
||||||
closureIterator.addPragma(newIdentNode("closure"))
|
closureIterator.addPragma(newIdentNode("closure"))
|
||||||
|
|
||||||
# If proc has an explicit gcsafe pragma, we add it to iterator as well.
|
# If proc has an explicit gcsafe pragma, we add it to iterator as well.
|
||||||
if prc.pragma.findChild(it.kind in {nnkSym, nnkIdent} and $it == "gcsafe") != nil:
|
if prc.pragma.findChild(it.kind in {nnkSym, nnkIdent} and $it ==
|
||||||
|
"gcsafe") != nil:
|
||||||
closureIterator.addPragma(newIdentNode("gcsafe"))
|
closureIterator.addPragma(newIdentNode("gcsafe"))
|
||||||
outerProcBody.add(closureIterator)
|
outerProcBody.add(closureIterator)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -603,7 +603,8 @@ proc recvLine*(socket: AsyncSocket,
|
||||||
await socket.recvLineInto(resString, flags, maxLength)
|
await socket.recvLineInto(resString, flags, maxLength)
|
||||||
result = resString.mget()
|
result = resString.mget()
|
||||||
|
|
||||||
proc listen*(socket: AsyncSocket, backlog = SOMAXCONN) {.tags: [ReadIOEffect].} =
|
proc listen*(socket: AsyncSocket, backlog = SOMAXCONN) {.tags: [
|
||||||
|
ReadIOEffect].} =
|
||||||
## Marks ``socket`` as accepting connections.
|
## Marks ``socket`` as accepting connections.
|
||||||
## ``Backlog`` specifies the maximum length of the
|
## ``Backlog`` specifies the maximum length of the
|
||||||
## queue of pending connections.
|
## queue of pending connections.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue