Use "do ():" for compatibility with Nim 2.0.0

This commit is contained in:
Emery Hemingway 2022-12-21 23:01:06 -06:00
parent a5c2d30ec4
commit 00269c04b1
3 changed files with 8 additions and 8 deletions

View File

@ -393,7 +393,7 @@ proc spawn*(name: string; turn: var Turn; bootProc: TurnAction; initialAssertion
var newOutBound: Table[Handle, OutboundAssertion] var newOutBound: Table[Handle, OutboundAssertion]
for key in initialAssertions: for key in initialAssertions:
discard turn.facet.outbound.pop(key, newOutbound[key]) discard turn.facet.outbound.pop(key, newOutbound[key])
callSoon: callSoon do ():
discard newActor(name, bootProc, newOutBound) discard newActor(name, bootProc, newOutBound)
proc newInertRef*(): Ref = proc newInertRef*(): Ref =
@ -413,7 +413,7 @@ proc terminate(actor; turn; reason: ref Exception) =
actor.future.complete() actor.future.complete()
else: else:
actor.future.fail reason actor.future.fail reason
callSoon: callSoon do ():
run(actor.root, finish, true) run(actor.root, finish, true)
proc terminate*(facet; e: ref Exception) = proc terminate*(facet; e: ref Exception) =
@ -423,7 +423,7 @@ proc terminate*(facet; e: ref Exception) =
proc asyncCheck*(turn; fut: FutureBase) = proc asyncCheck*(turn; fut: FutureBase) =
## Sets a callback on `fut` which propagates exceptions to the facet of `turn`. ## Sets a callback on `fut` which propagates exceptions to the facet of `turn`.
let facet = turn.facet let facet = turn.facet
fut.addCallback do: fut.addCallback do ():
if fut.failed: terminate(facet, fut.error) if fut.failed: terminate(facet, fut.error)
template tryFacet(facet; body: untyped) = template tryFacet(facet; body: untyped) =
@ -433,7 +433,7 @@ template tryFacet(facet; body: untyped) =
#except: terminate(facet, getCurrentException()) #except: terminate(facet, getCurrentException())
proc run(queues: Queues) = proc run(queues: Queues) =
callSoon: callSoon do ():
for facet, queue in queues: for facet, queue in queues:
for action in queue: run(facet, action) for action in queue: run(facet, action)
@ -459,7 +459,7 @@ proc addCallback*(fut: FutureBase; turn: var Turn; act: TurnAction) =
if fut.finished: if fut.finished:
enqueue(turn, facet, act) enqueue(turn, facet, act)
else: else:
fut.addCallback do: fut.addCallback do ():
run(facet, act) run(facet, act)
proc addCallback*[T](fut: Future[T]; turn: var Turn; cb: proc (t: var Turn; f: Future[T]) {.closure, gcsafe.}) = proc addCallback*[T](fut: Future[T]; turn: var Turn; cb: proc (t: var Turn; f: Future[T]) {.closure, gcsafe.}) =

View File

@ -31,7 +31,7 @@ proc connectNet*(turn: var Turn; remote: RemoteSpecifier; cap: SturdyRef; bootPr
reenable = facet.preventInertCheck() reenable = facet.preventInertCheck()
connectionClosedRef = newRef(turn, ShutdownEntity()) connectionClosedRef = newRef(turn, ShutdownEntity())
conn = connectTcp(remote) conn = connectTcp(remote)
conn.onReady do: conn.onReady do ():
discard bootActor("net") do (turn: var Turn): discard bootActor("net") do (turn: var Turn):
var shutdownRef: Ref var shutdownRef: Ref
proc tapsWriter(pkt: sink Packet): Future[void] = proc tapsWriter(pkt: sink Packet): Future[void] =
@ -53,7 +53,7 @@ proc connectNet*(turn: var Turn; remote: RemoteSpecifier; cap: SturdyRef; bootPr
terminate(facet, reason) terminate(facet, reason)
conn.onReceiveError do (ctx: MessageContext; reason: ref Exception): conn.onReceiveError do (ctx: MessageContext; reason: ref Exception):
terminate(facet, reason) terminate(facet, reason)
conn.onClosed do: conn.onClosed do ():
run(facet) do (turn: var Turn): run(facet) do (turn: var Turn):
stopActor(turn) stopActor(turn)
var wireBuf = newBufferedDecoder() var wireBuf = newBufferedDecoder()

View File

@ -112,7 +112,7 @@ proc send(r: Relay; pkt: sink Packet): Future[void] =
proc send(r: Relay; rOid: protocol.Oid; m: Event) = proc send(r: Relay; rOid: protocol.Oid; m: Event) =
if r.pendingTurn.len == 0: if r.pendingTurn.len == 0:
callSoon: callSoon do ():
r.facet.run do (turn: var Turn): r.facet.run do (turn: var Turn):
var pkt = Packet( var pkt = Packet(
orKind: PacketKind.Turn, orKind: PacketKind.Turn,