From cd10595abba4e854515bce4dd1eca1a3496105f1 Mon Sep 17 00:00:00 2001 From: repr-man Date: Mon, 19 Jun 2023 10:12:30 -0500 Subject: [PATCH] Remove parens that stop compiler spec from passing --- spec/TCP.Spec.savi | 2 +- src/TCP.Engine.savi | 10 +++++----- src/TCP.Listen.Engine.savi | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spec/TCP.Spec.savi b/spec/TCP.Spec.savi index 75fd67c..fd824be 100644 --- a/spec/TCP.Spec.savi +++ b/spec/TCP.Spec.savi @@ -96,7 +96,7 @@ @env.err.print("[EchoClient] Failed to connect.") | IO.Action.Read | - if (@io.read_stream.bytes_ahead_of_marker >= b"Hello, World!".size) ( + if @io.read_stream.bytes_ahead_of_marker >= b"Hello, World!".size ( bytes val = @io.read_stream.extract_all @env.err.print("[EchoClient] Received: \(Inspect[bytes])") @io.close diff --git a/src/TCP.Engine.savi b/src/TCP.Engine.savi index b68bba0..e6ed3cb 100644 --- a/src/TCP.Engine.savi +++ b/src/TCP.Engine.savi @@ -33,7 +33,7 @@ // If we failed to resolve any valid connection attempts, send the actor // a later IO action that will let it know that connection has failed. - if (@_pending_connect_count == 0) ( + if @_pending_connect_count == 0 ( actor.io_deferred_action(IO.Action.OpenFailed) ) @@ -53,7 +53,7 @@ :yields IO.Action // If we haven't adopted an event yet, and this one is ready to be adopted, // try to adopt it now, as we expect it is one of our pending connections. - if (@io.is_waiting_to_open && event.is_writable) ( + if @io.is_waiting_to_open && event.is_writable ( try ( @_pending_connect_count -= 1 @io.adopt_event!(event) @@ -62,7 +62,7 @@ // We failed to adopt it because it was a failed connection attempt. // If there are no more pending connection attempts, our last one has // failed and we have no choice but to admit final failure. - if (@_pending_connect_count == 0) ( + if @_pending_connect_count == 0 ( yield IO.Action.OpenFailed ) @@ -98,7 +98,7 @@ // If the underlying engine didn't want to handle this event, it means // this is likely a later connection attempt after we already had one. // If we have more connection attempts pending, we'll unsubscribe it. - if (@_pending_connect_count > 0) ( + if @_pending_connect_count > 0 ( @_pending_connect_count -= 1 _FFI.pony_asio_event_unsubscribe(event.id) | @@ -141,7 +141,7 @@ while @io.is_readable ( try ( bytes_read = @read_stream.receive_from!(@io) - if (bytes_read > 0) (yield None) + if bytes_read > 0 (yield None) ) ) diff --git a/src/TCP.Listen.Engine.savi b/src/TCP.Listen.Engine.savi index 0d0160a..2c9d114 100644 --- a/src/TCP.Listen.Engine.savi +++ b/src/TCP.Listen.Engine.savi @@ -27,7 +27,7 @@ @_listen_netaddr!.ip_address_with_port_number :fun _listen_netaddr! - error! if (@_fd == -1) + error! if @_fd == -1 _NetAddress._for_fd(@_fd) :new (@_actor, ticket TCP.Listen.Ticket, @_limit = 0) @@ -48,7 +48,7 @@ // TODO: Delegate much of the AsioEvent internals to an `IO.CoreEngine`. :fun ref react(event AsioEvent) @ - if (event.id === @_event_id) ( + if event.id === @_event_id ( if event.is_readable ( yield IO.Action.Read ) @@ -67,7 +67,7 @@ | if @_closed.not ( try ( - while (@_limit == 0 || @_count < @_limit) ( + while @_limit == 0 || @_count < @_limit ( conn_fd = _FFI.pony_os_accept(@_event_id) case conn_fd == ( | 0 | error! // EWOULDBLOCK, don't try again @@ -83,12 +83,12 @@ ) :fun ref deferred_action(action IO.Action) - if (action == IO.Action.ClosedChild) ( + if action == IO.Action.ClosedChild ( @_count -= 1 // If releasing this connection takes us below the limit, // unpause acceptance and try to accept more connections. - if (@_paused && @_count < @_limit) ( + if @_paused && @_count < @_limit ( @_paused = False yield IO.Action.Read ) @@ -98,7 +98,7 @@ @ :fun ref close - if (@_closed.not && @_event_id.is_not_null) ( + if @_closed.not && @_event_id.is_not_null ( // When not on windows, unsubscribe immediately here instead of later. if Platform.is_windows.not _FFI.pony_asio_event_unsubscribe(@_event_id)