summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2019-03-23 06:41:51 +0100
committerEugen Wissner <belka@caraus.de>2019-03-23 06:42:50 +0100
commit76f2cd7080c948206d5a1b7486a5dfb95476f684 (patch)
treea2adf8b04df38102430f8d6f62a8a0cdeda1c2f9 /source
parentad46afb10bca80086b11b998bf4c992dc96f577e (diff)
downloadtanya-76f2cd7080c948206d5a1b7486a5dfb95476f684.tar.gz
Add DIP25 compatibility. Fix #83
Diffstat (limited to 'source')
-rw-r--r--source/tanya/async/event/iocp.d18
-rw-r--r--source/tanya/async/event/selector.d36
-rw-r--r--source/tanya/async/loop.d14
-rw-r--r--source/tanya/async/transport.d10
-rw-r--r--source/tanya/async/watcher.d12
-rw-r--r--source/tanya/format.d2
-rw-r--r--source/tanya/net/ip.d5
-rw-r--r--source/tanya/typecons.d2
8 files changed, 20 insertions, 79 deletions
diff --git a/source/tanya/async/event/iocp.d b/source/tanya/async/event/iocp.d
index a32e04c..d7b782d 100644
--- a/source/tanya/async/event/iocp.d
+++ b/source/tanya/async/event/iocp.d
@@ -67,11 +67,7 @@ final class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Postcondition: $(D_INLINECODE socket !is null)
*/
override @property OverlappedConnectedSocket socket() pure nothrow @safe @nogc
- out (socket)
- {
- assert(socket !is null);
- }
- do
+ out (socket; socket !is null)
{
return cast(OverlappedConnectedSocket) socket_;
}
@@ -124,11 +120,7 @@ final class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Precondition: $(D_INLINECODE protocol !is null)
*/
@property void protocol(Protocol protocol) pure nothrow @safe @nogc
- in
- {
- assert(protocol !is null);
- }
- do
+ in (protocol !is null)
{
protocol_ = protocol;
}
@@ -264,11 +256,7 @@ final class IOCPLoop : Loop
private void kill(StreamTransport transport,
SocketException exception = null) @nogc
- in
- {
- assert(transport !is null);
- }
- do
+ in (transport !is null)
{
transport.socket.shutdown();
defaultAllocator.dispose(transport.socket);
diff --git a/source/tanya/async/event/selector.d b/source/tanya/async/event/selector.d
index 1cc4515..5adc921 100644
--- a/source/tanya/async/event/selector.d
+++ b/source/tanya/async/event/selector.d
@@ -75,22 +75,14 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Postcondition: $(D_INLINECODE socket !is null)
*/
override @property ConnectedSocket socket() pure nothrow @safe @nogc
- out (socket)
- {
- assert(socket !is null);
- }
- do
+ out (socket; socket !is null)
{
return cast(ConnectedSocket) socket_;
}
private @property void socket(ConnectedSocket socket)
pure nothrow @safe @nogc
- in
- {
- assert(socket !is null);
- }
- do
+ in (socket !is null)
{
socket_ = socket;
}
@@ -114,11 +106,7 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Precondition: $(D_INLINECODE protocol !is null)
*/
@property void protocol(Protocol protocol) pure nothrow @safe @nogc
- in
- {
- assert(protocol !is null);
- }
- do
+ in (protocol !is null)
{
protocol_ = protocol;
}
@@ -257,11 +245,7 @@ abstract class SelectorLoop : Loop
*/
protected void kill(StreamTransport transport,
SocketException exception = null) @nogc
- in
- {
- assert(transport !is null);
- }
- do
+ in (transport !is null)
{
transport.socket.shutdown();
defaultAllocator.dispose(transport.socket);
@@ -283,11 +267,7 @@ abstract class SelectorLoop : Loop
*/
protected bool feed(StreamTransport transport,
SocketException exception = null) @nogc
- in
- {
- assert(transport !is null);
- }
- do
+ in (transport !is null)
{
while (transport.input.length && transport.writeReady)
{
@@ -350,11 +330,7 @@ abstract class SelectorLoop : Loop
* connection = Connection watcher ready to accept.
*/
package void acceptConnections(ConnectionWatcher connection) @nogc
- in
- {
- assert(connection !is null);
- }
- do
+ in (connection !is null)
{
while (true)
{
diff --git a/source/tanya/async/loop.d b/source/tanya/async/loop.d
index 2c13397..6a79b4b 100644
--- a/source/tanya/async/loop.d
+++ b/source/tanya/async/loop.d
@@ -262,12 +262,8 @@ abstract class Loop
* $(D_PSYMBOL maxBlockTime).
*/
protected @property void blockTime(in Duration blockTime) @safe pure nothrow @nogc
- in
- {
- assert(blockTime <= 1.dur!"hours", "Too long to wait.");
- assert(!blockTime.isNegative);
- }
- do
+ in (blockTime <= 1.dur!"hours", "Too long to wait.")
+ in (!blockTime.isNegative)
{
blockTime_ = blockTime;
}
@@ -340,11 +336,7 @@ class BadLoopException : Exception
* loop = The event loop.
*/
@property void defaultLoop(Loop loop) @nogc
-in
-{
- assert(loop !is null);
-}
-do
+in (loop !is null)
{
defaultLoop_ = loop;
}
diff --git a/source/tanya/async/transport.d b/source/tanya/async/transport.d
index c516ae2..a536e4b 100644
--- a/source/tanya/async/transport.d
+++ b/source/tanya/async/transport.d
@@ -57,10 +57,7 @@ interface DuplexTransport : ReadTransport, WriteTransport
* Postcondition: $(D_INLINECODE protocol !is null)
*/
@property Protocol protocol() pure nothrow @safe @nogc
- out (protocol)
- {
- assert(protocol !is null);
- }
+ out (protocol; protocol !is null);
/**
* Switches the protocol.
@@ -73,10 +70,7 @@ interface DuplexTransport : ReadTransport, WriteTransport
* Precondition: $(D_INLINECODE protocol !is null)
*/
@property void protocol(Protocol protocol) pure nothrow @safe @nogc
- in
- {
- assert(protocol !is null);
- }
+ in (protocol !is null);
/**
diff --git a/source/tanya/async/watcher.d b/source/tanya/async/watcher.d
index 9feb1df..a16fb90 100644
--- a/source/tanya/async/watcher.d
+++ b/source/tanya/async/watcher.d
@@ -52,11 +52,7 @@ abstract class SocketWatcher : Watcher
* Precondition: $(D_INLINECODE socket !is null)
*/
this(Socket socket) pure nothrow @safe @nogc
- in
- {
- assert(socket !is null);
- }
- do
+ in (socket !is null)
{
socket_ = socket;
}
@@ -102,11 +98,7 @@ class ConnectionWatcher : SocketWatcher
* Invokes new connection callback.
*/
override void invoke() @nogc
- in
- {
- assert(protocolFactory !is null, "Protocol isn't set.");
- }
- do
+ in (protocolFactory !is null, "Protocol isn't set.")
{
for (; !this.incoming.empty; this.incoming.removeFront())
{
diff --git a/source/tanya/format.d b/source/tanya/format.d
index 806fc1f..aa1c41f 100644
--- a/source/tanya/format.d
+++ b/source/tanya/format.d
@@ -1928,7 +1928,7 @@ private char[] errol3(double value,
* $(D_PARAM sign).
*/
private const(char)[] real2String(double value,
- ref char[512] buffer,
+ return ref char[512] buffer,
out int exponent,
out bool sign) @nogc nothrow pure @trusted
{
diff --git a/source/tanya/net/ip.d b/source/tanya/net/ip.d
index 92acd3d..eff93ba 100644
--- a/source/tanya/net/ip.d
+++ b/source/tanya/net/ip.d
@@ -57,10 +57,9 @@ struct Address4
* Params:
* address = The address as an unsigned integer in host byte order.
*/
- this(uint address) @nogc nothrow pure @safe
+ this(uint address) @nogc nothrow pure @trusted
{
- copy(NetworkOrder!4(address),
- (() @trusted => (cast(ubyte*) &this.address)[0 .. 4])());
+ copy(NetworkOrder!4(address), (cast(ubyte*) &this.address)[0 .. 4]);
}
///
diff --git a/source/tanya/typecons.d b/source/tanya/typecons.d
index 02f5e72..1007246 100644
--- a/source/tanya/typecons.d
+++ b/source/tanya/typecons.d
@@ -608,7 +608,7 @@ if (isTypeTuple!Specs && NoDuplicates!Specs.length == Specs.length)
return this;
}
- private ref typeof(this) copyAssign(T)(ref T that)
+ private ref typeof(this) copyAssign(T)(ref T that) return
{
this.tag = staticIndexOf!(T, Types);