Follow the convention of naming types as UpperCase

This commit is contained in:
Zahary Karadjov 2020-01-21 18:50:50 +02:00
parent 6f9da4ba8a
commit 9b401994a1
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609

View File

@ -227,15 +227,15 @@ macro rpc*(server: RpcRouter, path: string, body: untyped): untyped =
procBody = if body.kind == nnkStmtList: body else: body.body procBody = if body.kind == nnkStmtList: body else: body.body
if parameters.hasReturnType: if parameters.hasReturnType:
let returnType = parameters[0] let ReturnType = parameters[0]
# delegate async proc allows return and setting of result as native type # delegate async proc allows return and setting of result as native type
result.add quote do: result.add quote do:
proc `doMain`(`paramsIdent`: JsonNode): Future[`returnType`] {.async.} = proc `doMain`(`paramsIdent`: JsonNode): Future[`ReturnType`] {.async.} =
`setup` `setup`
`procBody` `procBody`
if returnType == ident"JsonNode": if ReturnType == ident"JsonNode":
# `JsonNode` results don't need conversion # `JsonNode` results don't need conversion
result.add quote do: result.add quote do:
proc `procName`(`paramsIdent`: JsonNode): Future[JsonNode] {.async, gcsafe.} = proc `procName`(`paramsIdent`: JsonNode): Future[JsonNode] {.async, gcsafe.} =