Replace body with do

This commit is contained in:
Eugen Wissner 2018-01-31 12:05:06 +01:00
parent fd02c411e1
commit 048ddf21ff
22 changed files with 176 additions and 175 deletions

View File

@ -77,7 +77,7 @@ in
{
assert(&source !is &target, "Source and target must be different");
}
body
do
{
static if (is(T == struct) || isStaticArray!T)
{

View File

@ -72,7 +72,7 @@ final class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
{
assert(socket !is null);
}
body
do
{
return cast(OverlappedConnectedSocket) socket_;
}
@ -130,7 +130,7 @@ final class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
{
assert(protocol !is null);
}
body
do
{
protocol_ = protocol;
}
@ -270,7 +270,7 @@ final class IOCPLoop : Loop
{
assert(transport !is null);
}
body
do
{
transport.socket.shutdown();
defaultAllocator.dispose(transport.socket);

View File

@ -61,7 +61,7 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
{
assert(loop !is null);
}
body
do
{
super(socket);
this.loop = loop;
@ -80,7 +80,7 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
{
assert(socket !is null);
}
body
do
{
return cast(ConnectedSocket) socket_;
}
@ -91,7 +91,7 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
{
assert(socket !is null);
}
body
do
{
socket_ = socket;
}
@ -120,7 +120,7 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
{
assert(protocol !is null);
}
body
do
{
protocol_ = protocol;
}
@ -263,7 +263,7 @@ abstract class SelectorLoop : Loop
{
assert(transport !is null);
}
body
do
{
transport.socket.shutdown();
defaultAllocator.dispose(transport.socket);
@ -289,7 +289,7 @@ abstract class SelectorLoop : Loop
{
assert(transport !is null);
}
body
do
{
while (transport.input.length && transport.writeReady)
{
@ -356,7 +356,7 @@ abstract class SelectorLoop : Loop
{
assert(connection !is null);
}
body
do
{
while (true)
{

View File

@ -326,7 +326,7 @@ abstract class Loop
assert(blockTime <= 1.dur!"hours", "Too long to wait.");
assert(!blockTime.isNegative);
}
body
do
{
blockTime_ = blockTime;
}
@ -414,7 +414,7 @@ in
{
assert(loop !is null);
}
body
do
{
defaultLoop_ = loop;
}

View File

@ -72,7 +72,7 @@ abstract class SocketWatcher : Watcher
{
assert(socket !is null);
}
body
do
{
socket_ = socket;
}
@ -123,7 +123,7 @@ class ConnectionWatcher : SocketWatcher
{
assert(protocolFactory !is null, "Protocol isn't set.");
}
body
do
{
foreach (transport; incoming)
{

View File

@ -56,7 +56,7 @@ struct Range(A)
assert(begin >= container.data);
assert(end <= container.data + container.length);
}
body
do
{
this.container = &container;
this.begin = begin;
@ -87,7 +87,7 @@ struct Range(A)
{
assert(!empty);
}
body
do
{
return *this.begin;
}
@ -97,7 +97,7 @@ struct Range(A)
{
assert(!empty);
}
body
do
{
return *(this.end - 1);
}
@ -107,7 +107,7 @@ struct Range(A)
{
assert(!empty);
}
body
do
{
++this.begin;
}
@ -117,7 +117,7 @@ struct Range(A)
{
assert(!empty);
}
body
do
{
--this.end;
}
@ -127,7 +127,7 @@ struct Range(A)
{
assert(i < length);
}
body
do
{
return *(this.begin + i);
}
@ -148,7 +148,7 @@ struct Range(A)
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(*this.container, this.begin + i, this.begin + j);
}
@ -159,7 +159,7 @@ struct Range(A)
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(*this.container, this.begin + i, this.begin + j);
}
@ -333,7 +333,7 @@ struct Array(T)
{
assert(allocator !is null);
}
body
do
{
allocator_ = allocator;
}
@ -597,7 +597,7 @@ struct Array(T)
{
assert(!empty);
}
body
do
{
length = length - 1;
}
@ -619,7 +619,7 @@ struct Array(T)
{
assert(removed <= howMany);
}
body
do
{
const toRemove = min(howMany, length);
@ -662,7 +662,7 @@ struct Array(T)
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
auto target = r.begin;
for (auto source = r.end; source != end; ++source, ++target)
@ -821,7 +821,7 @@ struct Array(T)
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
const oldLen = length;
const offset = r.end - this.data;
@ -838,7 +838,7 @@ struct Array(T)
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
return insertAfter!(T[])(r, el[]);
}
@ -852,7 +852,7 @@ struct Array(T)
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
const oldLen = length;
const offset = r.end - this.data;
@ -881,7 +881,7 @@ struct Array(T)
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
return insertAfter(Range(this, this.data, r.begin), el);
}
@ -894,7 +894,7 @@ struct Array(T)
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
return insertBefore!(T[])(r, el[]);
}
@ -908,7 +908,7 @@ struct Array(T)
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
const oldLen = length;
const offset = r.begin - this.data;
@ -1080,7 +1080,7 @@ struct Array(T)
{
assert(length > pos);
}
body
do
{
return *(this.data + pos);
}
@ -1185,7 +1185,7 @@ struct Array(T)
{
assert(!empty);
}
body
do
{
return *this.data;
}
@ -1212,7 +1212,7 @@ struct Array(T)
{
assert(!empty);
}
body
do
{
return *(this.data + length - 1);
}
@ -1245,7 +1245,7 @@ struct Array(T)
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(this, this.data + i, this.data + j);
}
@ -1257,7 +1257,7 @@ struct Array(T)
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(this, this.data + i, this.data + j);
}
@ -1328,7 +1328,7 @@ struct Array(T)
assert(i <= j);
assert(j <= length);
}
body
do
{
copy(value[], this.data[i .. j]);
return opSlice(i, j);
@ -1342,7 +1342,7 @@ struct Array(T)
assert(i <= j);
assert(j <= length);
}
body
do
{
fill(this.data[i .. j], value);
return opSlice(i, j);
@ -1356,7 +1356,7 @@ struct Array(T)
assert(j <= length);
assert(j - i == value.length);
}
body
do
{
copy(value, this.data[i .. j]);
return opSlice(i, j);

View File

@ -27,7 +27,7 @@ version (unittest)
{
assert(start < end);
}
body
do
{
auto numberRead = end - start;
for (ubyte i; i < numberRead; ++i)
@ -106,7 +106,7 @@ struct ReadBuffer(T = ubyte)
{
assert(allocator_ is null);
}
body
do
{
allocator_ = allocator;
}
@ -349,7 +349,7 @@ struct WriteBuffer(T = ubyte)
assert(size > 0);
assert(allocator !is null);
}
body
do
{
blockSize = size;
ring = size - 1;
@ -549,7 +549,7 @@ struct WriteBuffer(T = ubyte)
{
assert(length <= this.length);
}
body
do
{
auto afterRing = ring + 1;
auto oldStart = start;

View File

@ -64,7 +64,7 @@ struct SRange(L)
{
assert(!empty);
}
body
do
{
return (*this.head).content;
}
@ -74,7 +74,7 @@ struct SRange(L)
{
assert(!empty);
}
body
do
{
this.head = &(*this.head).next;
}
@ -205,7 +205,7 @@ struct SList(T)
{
assert(allocator !is null);
}
body
do
{
this.allocator_ = allocator;
}
@ -325,7 +325,7 @@ struct SList(T)
{
assert(!empty);
}
body
do
{
return this.head.content;
}
@ -467,7 +467,7 @@ struct SList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
return moveEntry(*r.head, el);
}
@ -490,7 +490,7 @@ struct SList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
size_t inserted;
foreach (e; el)
@ -519,7 +519,7 @@ struct SList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
*r.head = allocator.make!Entry(el, *r.head);
return 1;
@ -641,7 +641,7 @@ struct SList(T)
{
assert(!empty);
}
body
do
{
auto n = this.head.next;
@ -680,7 +680,7 @@ struct SList(T)
{
assert(removed <= howMany);
}
body
do
{
size_t i;
for (; i < howMany && !empty; ++i)
@ -716,7 +716,7 @@ struct SList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
auto outOfScopeList = typeof(this)(allocator);
outOfScopeList.head = *r.head;
@ -963,7 +963,7 @@ struct DRange(L)
{
assert(!empty);
}
body
do
{
return (*this.head).content;
}
@ -973,7 +973,7 @@ struct DRange(L)
{
assert(!empty);
}
body
do
{
return (*this.tail).content;
}
@ -983,7 +983,7 @@ struct DRange(L)
{
assert(!empty);
}
body
do
{
this.head = &(*this.head).next;
}
@ -993,7 +993,7 @@ struct DRange(L)
{
assert(!empty);
}
body
do
{
this.tail = &(*this.tail).prev;
}
@ -1135,7 +1135,7 @@ struct DList(T)
{
assert(allocator !is null);
}
body
do
{
this.allocator_ = allocator;
}
@ -1259,7 +1259,7 @@ struct DList(T)
{
assert(!empty);
}
body
do
{
return this.head.content;
}
@ -1272,7 +1272,7 @@ struct DList(T)
{
assert(!empty);
}
body
do
{
return this.tail.content;
}
@ -1311,17 +1311,17 @@ struct DList(T)
return 1;
}
// Creates a lsit of linked entries from a range.
// Returns count of the elements in the list.
private size_t makeList(R)(ref R el, out Entry* head, out Entry* tail) @trusted
out (retLength)
{
assert((retLength == 0 && head is null && tail is null)
|| (retLength > 0 && head !is null && tail !is null));
}
body
{
size_t retLength;
// Creates a lsit of linked entries from a range.
// Returns count of the elements in the list.
private size_t makeList(R)(ref R el, out Entry* head, out Entry* tail) @trusted
out (retLength)
{
assert((retLength == 0 && head is null && tail is null)
|| (retLength > 0 && head !is null && tail !is null));
}
do
{
size_t retLength;
if (!el.empty)
{
@ -1336,8 +1336,8 @@ struct DList(T)
tail = tail.next;
++retLength;
}
return retLength;
}
return retLength;
}
/**
* Inserts a new element at the beginning.
@ -1525,10 +1525,10 @@ struct DList(T)
{
this.head = begin;
}
else
{
else
{
this.tail.next = begin;
}
}
if (begin !is null)
{
this.tail = end;
@ -1595,7 +1595,7 @@ struct DList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
return moveFront(*r.head, el);
}
@ -1615,7 +1615,7 @@ struct DList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
auto temp = allocator.make!Entry(el, *r.head);
@ -1653,7 +1653,7 @@ struct DList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
size_t inserted;
foreach (e; el)
@ -1710,7 +1710,7 @@ struct DList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
return moveBack(*r.tail, el);
}
@ -1741,7 +1741,7 @@ struct DList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
auto temp = allocator.make!Entry(el, null, *r.tail);
@ -1779,7 +1779,7 @@ struct DList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
size_t inserted;
foreach (e; el)
@ -1896,7 +1896,7 @@ struct DList(T)
{
assert(!empty);
}
body
do
{
auto n = this.head.next;
@ -1932,7 +1932,7 @@ struct DList(T)
{
assert(!empty);
}
body
do
{
auto n = this.tail.prev;
@ -1978,7 +1978,7 @@ struct DList(T)
{
assert(removed <= howMany);
}
body
do
{
size_t i;
for (; i < howMany && !empty; ++i)
@ -2005,7 +2005,7 @@ struct DList(T)
{
assert(removed <= howMany);
}
body
do
{
size_t i;
for (; i < howMany && !empty; ++i)
@ -2041,7 +2041,7 @@ struct DList(T)
{
assert(checkRangeBelonging(r));
}
body
do
{
// Save references to the elements before and after the range.
Entry* tailNext, headPrev;

View File

@ -167,7 +167,7 @@ struct Queue(T)
{
assert(!empty);
}
body
do
{
auto n = first.next;
T ret = move(first.content);

View File

@ -76,7 +76,7 @@ struct Range(E)
assert(this.dataRange.empty
|| this.dataRange.back.status == BucketStatus.used);
}
body
do
{
do
{
@ -96,7 +96,7 @@ struct Range(E)
assert(this.dataRange.empty
|| this.dataRange.back.status == BucketStatus.used);
}
body
do
{
do
{
@ -111,7 +111,7 @@ struct Range(E)
assert(!this.dataRange.empty);
assert(this.dataRange.front.status == BucketStatus.used);
}
body
do
{
return dataRange.front.content;
}
@ -122,7 +122,7 @@ struct Range(E)
assert(!this.dataRange.empty);
assert(this.dataRange.back.status == BucketStatus.used);
}
body
do
{
return dataRange.back.content;
}
@ -180,7 +180,7 @@ struct Set(T)
{
assert(allocator !is null);
}
body
do
{
this(allocator);
rehash(n);
@ -192,7 +192,7 @@ struct Set(T)
{
assert(allocator !is null);
}
body
do
{
this.data = typeof(this.data)(allocator);
}
@ -227,7 +227,7 @@ struct Set(T)
{
assert(allocator !is null);
}
body
do
{
this.data = typeof(this.data)(init.data, allocator);
}
@ -239,7 +239,7 @@ struct Set(T)
{
assert(allocator !is null);
}
body
do
{
this.data = typeof(this.data)(move(init.data), allocator);
this.lengthIndex = init.lengthIndex;
@ -285,7 +285,7 @@ struct Set(T)
{
assert(allocator !is null);
}
body
do
{
return cast(shared Allocator) this.data.allocator;
}
@ -371,7 +371,7 @@ struct Set(T)
{
assert(buckets.length > 0);
}
body
do
{
return hash % buckets.length;
}

View File

@ -91,7 +91,7 @@ if (is(Unqual!E == char))
assert(begin >= container.data);
assert(end <= container.data + container.length);
}
body
do
{
this.container = &container;
this.begin = begin;
@ -122,7 +122,7 @@ if (is(Unqual!E == char))
{
assert(!empty);
}
body
do
{
return *this.begin;
}
@ -132,7 +132,7 @@ if (is(Unqual!E == char))
{
assert(!empty);
}
body
do
{
return *(this.end - 1);
}
@ -142,7 +142,7 @@ if (is(Unqual!E == char))
{
assert(!empty);
}
body
do
{
++this.begin;
}
@ -152,7 +152,7 @@ if (is(Unqual!E == char))
{
assert(!empty);
}
body
do
{
--this.end;
}
@ -162,7 +162,7 @@ if (is(Unqual!E == char))
{
assert(i < length);
}
body
do
{
return *(this.begin + i);
}
@ -183,7 +183,7 @@ if (is(Unqual!E == char))
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(*this.container, this.begin + i, this.begin + j);
}
@ -194,7 +194,7 @@ if (is(Unqual!E == char))
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(*this.container, this.begin + i, this.begin + j);
}
@ -233,7 +233,7 @@ if (is(Unqual!E == char))
assert(begin >= container.data);
assert(end <= container.data + container.length);
}
body
do
{
this.container = &container;
this.begin = begin;
@ -261,7 +261,7 @@ if (is(Unqual!E == char))
{
assert(chr < 0xd800 || chr > 0xdfff);
}
body
do
{
dchar chr;
ubyte units;
@ -295,7 +295,7 @@ if (is(Unqual!E == char))
{
assert(!empty);
}
body
do
{
ubyte units;
if ((*begin & 0xf0) == 0xf0)
@ -438,7 +438,7 @@ struct String
{
assert(allocator !is null);
}
body
do
{
this.allocator_ = allocator;
}
@ -528,7 +528,7 @@ struct String
assert(capacity - length >= 4);
assert(src - 0x10000 < 0x100000);
}
body
do
{
auto dst = this.data + length;
@ -546,7 +546,7 @@ struct String
{
assert(capacity - length >= 3);
}
body
do
{
auto dst = this.data + length;
if (chr < 0x80)
@ -924,7 +924,7 @@ struct String
assert(j <= length);
assert(j - i == value.length);
}
body
do
{
auto target = opSlice(i, j);
copy(value, target);
@ -941,7 +941,7 @@ struct String
assert(i <= j);
assert(j <= length);
}
body
do
{
copy(value[], this.data[i .. j]);
return opSlice(i, j);
@ -957,7 +957,7 @@ struct String
assert(i <= j);
assert(j <= length);
}
body
do
{
for (auto p = this.data + i; p < this.data + j; ++p)
{
@ -1038,7 +1038,7 @@ struct String
{
assert(length > pos);
}
body
do
{
return *(this.data + pos);
}
@ -1188,7 +1188,7 @@ struct String
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(this, this.data + i, this.data + j);
}
@ -1201,7 +1201,7 @@ struct String
assert(i <= j);
assert(j <= length);
}
body
do
{
return typeof(return)(this, this.data + i, this.data + j);
}
@ -1509,7 +1509,7 @@ struct String
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
auto end = this.data + this.length;
copy(ByCodeUnit!char(this, r.end, end), ByCodeUnit!char(this, r.begin, end));
@ -1562,7 +1562,7 @@ struct String
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
auto oldLen = this.data + length;
const inserted = insertBack(el);
@ -1595,7 +1595,7 @@ struct String
assert(r.begin >= this.data);
assert(r.end <= this.data + length);
}
body
do
{
return insertAfter(R(this, this.data, r.begin), el);
}

View File

@ -66,7 +66,7 @@ out (result)
{
assert(memory.ptr is (() @trusted => cast(void*) result)());
}
body
do
{
copy(typeid(T).initializer, memory);
@ -91,7 +91,8 @@ in
out (result)
{
assert(memory.ptr is (() @trusted => cast(void*) result)());
}body
}
do
{
copy(typeid(T).initializer, memory);
@ -144,7 +145,7 @@ out (result)
{
assert(memory.ptr is result);
}
body
do
{
auto result = (() @trusted => cast(T*) memory.ptr)();
static if (Args.length == 1)
@ -169,7 +170,7 @@ out (result)
{
assert(memory.ptr is result);
}
body
do
{
auto result = (() @trusted => cast(T*) memory.ptr)();
static if (!hasElaborateAssign!T && isAssignable!T)

View File

@ -112,7 +112,7 @@ struct Integer
{
assert(allocator !is null);
}
body
do
{
this.allocator_ = allocator;
}
@ -873,7 +873,7 @@ struct Integer
{
assert(operand.length > 0, "Division by zero.");
}
body
do
{
divide(operand, this);
return this;
@ -885,7 +885,7 @@ struct Integer
{
assert(operand.length > 0, "Division by zero.");
}
body
do
{
divide(operand, null, this);
return this;
@ -1168,7 +1168,7 @@ struct Integer
{
assert(operand.length > 0, "Division by zero.");
}
body
do
{
mixin("return Integer(this, allocator) " ~ op ~ "= operand;");
}
@ -1287,7 +1287,7 @@ struct Integer
{
assert(divisor != 0, "Division by zero.");
}
body
do
{
if (compare(divisor) < 0)
{
@ -1472,7 +1472,7 @@ struct Integer
{
assert(array.length == length);
}
body
do
{
Array!ubyte array;

View File

@ -586,7 +586,7 @@ in
{
assert(z > 0, "Division by zero.");
}
body
do
{
G mask = G.max / 2 + 1;
H result;
@ -627,7 +627,7 @@ in
{
assert(z.length > 0, "Division by zero.");
}
body
do
{
size_t i;
auto tmp1 = Integer(x, x.allocator);

View File

@ -134,7 +134,7 @@ version (linux)
{
assert(length <= maxGather);
}
body
do
{
// int getrandom(void *buf, size_t buflen, unsigned int flags);
auto length = syscall(318, output.ptr, output.length, 0);
@ -198,7 +198,7 @@ class Entropy
assert(maxSources > 0 && maxSources <= ubyte.max);
assert(allocator !is null);
}
body
do
{
allocator.resize(sources, maxSources);
@ -234,7 +234,7 @@ class Entropy
{
assert(sourceCount_ <= sources.length);
}
body
do
{
sources[sourceCount_++] = source;
return this;
@ -251,7 +251,7 @@ class Entropy
{
assert(sourceCount_ > 0, "No entropy sources defined.");
}
body
do
{
bool haveStrong;
ushort done;

View File

@ -58,7 +58,7 @@ in
assert(source.length == 0 || source.ptr !is null);
assert(target.length == 0 || target.ptr !is null);
}
body
do
{
version (TanyaNative)
{
@ -126,7 +126,7 @@ in
{
assert(memory.length == 0 || memory.ptr !is null);
}
body
do
{
version (TanyaNative)
{
@ -203,7 +203,7 @@ in
assert(source.length == 0 || source.ptr !is null);
assert(target.length == 0 || target.ptr !is null);
}
body
do
{
version (TanyaNative)
{
@ -257,7 +257,7 @@ in
assert(r1.length == 0 || r1.ptr !is null);
assert(r2.length == 0 || r2.ptr !is null);
}
body
do
{
version (TanyaNative)
{
@ -321,7 +321,7 @@ in
{
assert(haystack.length == 0 || haystack.ptr !is null);
}
body
do
{
auto length = haystack.length;
const size_t needleWord = size_t.max * needle;

View File

@ -45,7 +45,7 @@ mixin template DefaultAllocator()
{
assert(allocator !is null);
}
body
do
{
this.allocator_ = allocator;
}
@ -63,7 +63,7 @@ mixin template DefaultAllocator()
{
assert(allocator !is null);
}
body
do
{
if (allocator_ is null)
{
@ -78,7 +78,7 @@ mixin template DefaultAllocator()
{
assert(allocator !is null);
}
body
do
{
if (allocator_ is null)
{
@ -114,7 +114,7 @@ out (allocator)
{
assert(allocator !is null);
}
body
do
{
return (cast(GetPureInstance!Allocator) &getAllocatorInstance)();
}
@ -132,7 +132,7 @@ in
{
assert(allocator !is null);
}
body
do
{
.allocator = allocator;
}
@ -403,7 +403,7 @@ in
{
assert(allocator !is null);
}
body
do
{
auto mem = (() @trusted => allocator.allocate(stateSize!T))();
if (mem is null)
@ -442,7 +442,7 @@ in
{
assert(allocator !is null);
}
body
do
{
auto mem = (() @trusted => allocator.allocate(stateSize!T))();
if (mem is null)
@ -484,7 +484,7 @@ in
assert(allocator !is null);
assert(n <= size_t.max / ElementType!T.sizeof);
}
body
do
{
auto ret = allocator.resize!(ElementType!T)(null, n);
ret.uninitializedFill(ElementType!T.init);

View File

@ -54,7 +54,7 @@ private final class RefCountedStore(T)
{
assert(this.counter > 0);
}
body
do
{
mixin("return " ~ op ~ "counter;");
}
@ -139,7 +139,7 @@ struct RefCounted(T)
{
assert(allocator !is null);
}
body
do
{
this.allocator_ = allocator;
}
@ -247,7 +247,7 @@ struct RefCounted(T)
{
assert(count > 0, "Attempted to access an uninitialized reference");
}
body
do
{
return this.storage.payload;
}
@ -501,7 +501,7 @@ in
{
assert(allocator !is null);
}
body
do
{
auto rc = typeof(return)(allocator);
@ -546,7 +546,7 @@ in
assert(allocator !is null);
assert(size <= size_t.max / ElementType!T.sizeof);
}
body
do
{
return RefCounted!T(allocator.make!T(size), allocator);
}
@ -664,7 +664,7 @@ struct Unique(T)
{
assert(allocator !is null);
}
body
do
{
this.allocator_ = allocator;
}
@ -849,7 +849,7 @@ in
{
assert(allocator !is null);
}
body
do
{
auto payload = allocator.make!(T, A)(args);
return Unique!T(payload, allocator);
@ -877,7 +877,7 @@ in
assert(allocator !is null);
assert(size <= size_t.max / ElementType!T.sizeof);
}
body
do
{
auto payload = allocator.resize!(ElementType!T)(null, size);
return Unique!T(payload, allocator);

View File

@ -77,7 +77,7 @@ struct NetworkOrder(uint L)
{
assert(value <= pow(2, L * 8) - 1);
}
body
do
{
this.value = value & StorageType.max;
}
@ -92,7 +92,7 @@ struct NetworkOrder(uint L)
{
assert(this.length > 0);
}
body
do
{
return this.value & 0xff;
}
@ -107,7 +107,7 @@ struct NetworkOrder(uint L)
{
assert(this.length > 0);
}
body
do
{
return (this.value >> ((this.length - 1) * 8)) & 0xff;
}
@ -122,7 +122,7 @@ struct NetworkOrder(uint L)
{
assert(this.length > 0);
}
body
do
{
this.value >>= 8;
--this.size;
@ -138,7 +138,7 @@ struct NetworkOrder(uint L)
{
assert(this.length > 0);
}
body
do
{
this.value &= StorageType.max >> ((StorageType.sizeof - this.length) * 8);
--this.size;

View File

@ -185,7 +185,7 @@ else version (Windows)
{
assert(count >= 0);
}
body
do
{
DWORD lpNumber;
BOOL result = GetOverlappedResult(overlapped.handle,
@ -259,7 +259,7 @@ else version (Windows)
{
assert(count >= 0);
}
body
do
{
DWORD lpNumber;
BOOL result = GetOverlappedResult(overlapped.handle,
@ -720,7 +720,7 @@ abstract class Socket
assert(handle != SocketType.init);
assert(handle_ == SocketType.init, "Socket handle cannot be changed");
}
body
do
{
handle_ = handle;
@ -749,7 +749,7 @@ abstract class Socket
{
assert(handle != SocketType.init);
}
body
do
{
scope (failure)
{

View File

@ -59,7 +59,7 @@ in
{
assert(array.length > 0);
}
body
do
{
return array[0];
}
@ -99,7 +99,7 @@ in
{
assert(array.length > 0);
}
body
do
{
return array[$ - 1];
}
@ -138,7 +138,7 @@ in
{
assert(array.length > 0);
}
body
do
{
array = array[1 .. $];
}
@ -149,7 +149,7 @@ in
{
assert(array.length > 0);
}
body
do
{
array = array[0 .. $ - 1];
}

View File

@ -1053,7 +1053,7 @@ in
assert(count <= range.length);
}
}
body
do
{
static if (hasSlicing!R)
{
@ -1112,7 +1112,7 @@ in
assert(count <= range.length);
}
}
body
do
{
static if (hasSlicing!R)
{