Remove `var ref` on `rpc` macro and just take ref
This commit is contained in:
parent
db55114233
commit
6bfb4facc2
|
@ -44,7 +44,7 @@ proc hasReturnType(params: NimNode): bool =
|
|||
if params != nil and params.len > 0 and params[0] != nil and params[0].kind != nnkEmpty:
|
||||
result = true
|
||||
|
||||
macro rpc*(server: var RpcServer, path: string, body: untyped): untyped =
|
||||
macro rpc*(server: RpcServer, path: string, body: untyped): untyped =
|
||||
result = newStmtList()
|
||||
let
|
||||
parameters = body.findChild(it.kind == nnkFormalParams)
|
||||
|
|
|
@ -5,7 +5,7 @@ var srv = newRpcServer()
|
|||
srv.address = "localhost"
|
||||
srv.port = Port(8545)
|
||||
|
||||
proc makeProc(server: var RpcServer) =
|
||||
proc makeProc(server: RpcServer) =
|
||||
server.rpc("myProc") do(input: string, data: array[0..3, int]):
|
||||
result = %("Hello " & input & " data: " & $data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue