Skip to content

Commit

Permalink
Merge pull request #5869 from wilzbach/do-body
Browse files Browse the repository at this point in the history
Replace `body` keyword with its replacement: `do`
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Nov 20, 2017
2 parents d15447f + 85ec5de commit 5b7ceff
Show file tree
Hide file tree
Showing 39 changed files with 209 additions and 193 deletions.
2 changes: 1 addition & 1 deletion posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ROOT_OF_THEM_ALL = generated
ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(BUILD)/$(MODEL)
DUB=dub
TOOLS_DIR=../tools
DSCANNER_HASH=eb16fe4e8610e7477e09710fee1137d657a56f72
DSCANNER_HASH=bb32e9f1e3e5206deb11b3dbc43ad44e23fabf96
DSCANNER_DIR=../dscanner-$(DSCANNER_HASH)

# Documentation-related stuff
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/comparison.d
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ in
import std.functional : greaterThan;
assert(!lower.greaterThan(upper));
}
body
do
{
return max(lower, min(upper, val));
}
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ private struct _Cache(R, bool bidir)
{
assert(low <= high, "Bounds error when slicing cache.");
}
body
do
{
import std.range : takeExactly;
return this[low .. $].takeExactly(high - low);
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ in
{
assert(!r.empty, "r is an empty range");
}
body
do
{
alias Element = ElementType!Range;
Unqual!Element seed = r.front;
Expand Down
18 changes: 9 additions & 9 deletions std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ private template TimSortImpl(alias pred, R)
{
assert(ret <= range.length);
}
body
do
{
import std.algorithm.mutation : reverse;

Expand All @@ -2379,7 +2379,7 @@ private template TimSortImpl(alias pred, R)
{
if (!__ctfe) assert(isSorted!pred(range));
}
body
do
{
import std.algorithm.mutation : move;

Expand Down Expand Up @@ -2412,7 +2412,7 @@ private template TimSortImpl(alias pred, R)
assert(stack.length >= 2);
assert(stack.length - at == 2 || stack.length - at == 3);
}
body
do
{
immutable base = stack[at].base;
immutable mid = stack[at].length;
Expand All @@ -2437,7 +2437,7 @@ private template TimSortImpl(alias pred, R)
assert(isSorted!pred(range[mid .. range.length]));
}
}
body
do
{
assert(mid < range.length);

Expand Down Expand Up @@ -2468,7 +2468,7 @@ private template TimSortImpl(alias pred, R)
{
assert(ret.length >= minCapacity);
}
body
do
{
if (temp.length < minCapacity)
{
Expand All @@ -2489,7 +2489,7 @@ private template TimSortImpl(alias pred, R)
{
if (!__ctfe) assert(isSorted!pred(range));
}
body
do
{
import std.algorithm.mutation : copy;

Expand Down Expand Up @@ -2572,7 +2572,7 @@ private template TimSortImpl(alias pred, R)
{
if (!__ctfe) assert(isSorted!pred(range));
}
body
do
{
import std.algorithm.mutation : copy;

Expand Down Expand Up @@ -2678,7 +2678,7 @@ private template TimSortImpl(alias pred, R)
{
assert(ret <= range.length);
}
body
do
{
size_t lower = 0, center = 1, upper = range.length;
alias gap = center;
Expand Down Expand Up @@ -3349,7 +3349,7 @@ out
assert(r[0 .. pivot + 1].all!(x => !lp(r[pivot], x)));
assert(r[pivot + 1 .. r.length].all!(x => !lp(x, r[pivot])));
}
body
do
{
import std.algorithm.mutation : swapAt;
import std.algorithm.searching : all;
Expand Down
2 changes: 1 addition & 1 deletion std/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@ in
// Verify that slice[] really is a slice of s[]
assert(overlap(s, slice) is slice);
}
body
do
{
auto result = new T[s.length - slice.length + replacement.length];
immutable so = slice.ptr - s.ptr;
Expand Down
16 changes: 8 additions & 8 deletions std/base64.d
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
{
assert(result.length == encodeLength(source.length), "The length of result is different from Base64");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down Expand Up @@ -310,7 +310,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
// @@@BUG@@@ D's DbC can't caputre an argument of function and store the result of precondition.
//assert(result.length == encodeLength(source.length), "The length of result is different from Base64");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down Expand Up @@ -397,7 +397,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
{
assert(result == encodeLength(source.length), "The number of put is different from the length of Base64");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down Expand Up @@ -486,7 +486,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
// @@@BUG@@@ Workaround for DbC problem.
//assert(result == encodeLength(source.length), "The number of put is different from the length of Base64");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down Expand Up @@ -1005,7 +1005,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
immutable expect = realDecodeLength(source);
assert(result.length == expect, "The length of result is different from the expected length");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down Expand Up @@ -1091,7 +1091,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
//immutable expect = decodeLength(source.length) - 2;
//assert(result.length >= expect, "The length of result is smaller than expected length");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down Expand Up @@ -1182,7 +1182,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
immutable expect = realDecodeLength(source);
assert(result == expect, "The result of decode is different from the expected");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down Expand Up @@ -1271,7 +1271,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
//immutable expect = decodeLength(source.length) - 2;
//assert(result >= expect, "The length of result is smaller than expected length");
}
body
do
{
immutable srcLen = source.length;
if (srcLen == 0)
Expand Down
20 changes: 10 additions & 10 deletions std/bitmanip.d
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ public:
{
assert(i < _len);
}
body
do
{
return cast(bool) bt(_ptr, i);
}
Expand Down Expand Up @@ -877,7 +877,7 @@ public:
{
assert(i < _len);
}
body
do
{
if (b)
bts(_ptr, i);
Expand Down Expand Up @@ -929,7 +929,7 @@ public:
assert(start <= end);
assert(end <= length);
}
body
do
{
size_t startBlock = start / bitsPerSizeT;
size_t endBlock = end / bitsPerSizeT;
Expand Down Expand Up @@ -1208,7 +1208,7 @@ public:
{
assert(result == this);
}
body
do
{
if (_len >= 2)
{
Expand Down Expand Up @@ -1252,7 +1252,7 @@ public:
{
assert(result == this);
}
body
do
{
if (_len >= 2)
{
Expand Down Expand Up @@ -1506,7 +1506,7 @@ public:
assert(numbits <= v.length * 8);
assert(v.length % size_t.sizeof == 0);
}
body
do
{
_ptr = cast(size_t*) v.ptr;
_len = numbits;
Expand Down Expand Up @@ -1615,7 +1615,7 @@ public:
{
assert(_len == e2.length);
}
body
do
{
auto dim = this.dim;

Expand Down Expand Up @@ -1721,7 +1721,7 @@ public:
{
assert(_len == e2.length);
}
body
do
{
foreach (i; 0 .. fullWords)
{
Expand Down Expand Up @@ -1977,7 +1977,7 @@ public:
{
assert(nbits < bitsPerSizeT);
}
body
do
{
if (nbits == 0)
return lower;
Expand Down Expand Up @@ -2014,7 +2014,7 @@ public:
{
assert(nbits < bitsPerSizeT);
}
body
do
{
if (nbits == 0)
return upper;
Expand Down
6 changes: 3 additions & 3 deletions std/concurrency.d
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ in
"Cannot receive a message until a thread was spawned "
~ "or thisTid was passed to a running thread.");
}
body
do
{
checkops( ops );

Expand Down Expand Up @@ -737,7 +737,7 @@ in
assert(thisInfo.ident.mbox !is null,
"Cannot receive a message until a thread was spawned or thisTid was passed to a running thread.");
}
body
do
{
import std.format : format;
import std.typecons : Tuple;
Expand Down Expand Up @@ -801,7 +801,7 @@ in
assert(thisInfo.ident.mbox !is null,
"Cannot receive a message until a thread was spawned or thisTid was passed to a running thread.");
}
body
do
{
checkops(ops);

Expand Down
6 changes: 3 additions & 3 deletions std/container/rbtree.d
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct RBNode(V)
{
assert(_left !is null);
}
body
do
{
// sets _left._parent also
if (isLeftNode)
Expand Down Expand Up @@ -228,7 +228,7 @@ struct RBNode(V)
{
assert(_right !is null);
}
body
do
{
// sets _right._parent also
if (isLeftNode)
Expand Down Expand Up @@ -257,7 +257,7 @@ struct RBNode(V)
{
assert(_parent !is null);
}
body
do
{
return _parent._left is &this;
}
Expand Down
4 changes: 2 additions & 2 deletions std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ in
{
assert(radix >= 2 && radix <= 36);
}
body
do
{
alias EEType = Unqual!(ElementEncodingType!T);

Expand Down Expand Up @@ -2444,7 +2444,7 @@ in
{
assert(radix >= 2 && radix <= 36);
}
body
do
{
import core.checkedint : mulu, addu;
import std.exception : enforce;
Expand Down
6 changes: 3 additions & 3 deletions std/datetime/date.d
Original file line number Diff line number Diff line change
Expand Up @@ -3398,7 +3398,7 @@ public:
assert(result._date == Date.min);
assert(result._tod == TimeOfDay.min);
}
body
do
{
auto dt = DateTime.init;
dt._date._year = short.min;
Expand All @@ -3425,7 +3425,7 @@ public:
assert(result._date == Date.max);
assert(result._tod == TimeOfDay.max);
}
body
do
{
auto dt = DateTime.init;
dt._date._year = short.max;
Expand Down Expand Up @@ -9996,7 +9996,7 @@ in
{
assert(valid!"months"(month));
}
body
do
{
switch (month)
{
Expand Down

0 comments on commit 5b7ceff

Please sign in to comment.