Skip to content

Commit 3745079

Browse files
nordlowJohn-Colvin
authored andcommitted
Replace deprecated body with do
1 parent ca0fb54 commit 3745079

File tree

7 files changed

+33
-34
lines changed

7 files changed

+33
-34
lines changed

source/dstats/alloc.d

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public:
118118
void popFront()
119119
in {
120120
assert(!empty);
121-
} body {
121+
} do {
122122
this._length--;
123123
if(next is null) {
124124
do {
@@ -149,14 +149,14 @@ public:
149149
@property ref Unqual!(K) front()
150150
in {
151151
assert(!empty);
152-
} body {
152+
} do {
153153
return *frontElem;
154154
}
155155
} else {
156156
@property Unqual!(K) front()
157157
in {
158158
assert(!empty);
159-
} body {
159+
} do {
160160
return *frontElem;
161161
}
162162
}
@@ -911,7 +911,7 @@ struct AVLNodeBitwise(T) {
911911
void left(typeof(this)* newLeft) nothrow @property
912912
in {
913913
assert((cast(size_t) newLeft & mask) == 0);
914-
} body {
914+
} do {
915915
_left &= mask;
916916
_left |= cast(size_t) newLeft;
917917
assert(left is newLeft);
@@ -928,7 +928,7 @@ struct AVLNodeBitwise(T) {
928928
void right(typeof(this)* newRight) nothrow @property
929929
in {
930930
assert((cast(size_t) newRight & mask) == 0);
931-
} body {
931+
} do {
932932
_right &= mask;
933933
_right |= cast(size_t) newRight;
934934
assert(right is newRight);
@@ -1054,7 +1054,7 @@ private:
10541054
assert(node.left !is null);
10551055
assert( abs(node.balance) <= 2);
10561056

1057-
} body {
1057+
} do {
10581058
Node* newHead = node.left;
10591059
node.left = newHead.right;
10601060
newHead.right = node;
@@ -1070,7 +1070,7 @@ private:
10701070
in {
10711071
assert(node.right !is null);
10721072
assert( abs(node.balance) <= 2);
1073-
} body {
1073+
} do {
10741074
Node* newHead = node.right;
10751075
node.right = newHead.left;
10761076
newHead.left = node;
@@ -1087,7 +1087,7 @@ private:
10871087
assert(node is null || abs(node.balance) <= 2);
10881088
} out(ret) {
10891089
assert( abs(ret.balance) < 2);
1090-
} body {
1090+
} do {
10911091
if(node is null) {
10921092
return null;
10931093
}
@@ -1144,7 +1144,7 @@ private:
11441144
in {
11451145
assert(freeList);
11461146
assert(*freeList);
1147-
} body {
1147+
} do {
11481148
auto ret = *freeList;
11491149
*freeList = ret.right;
11501150
return ret;
@@ -1153,7 +1153,7 @@ private:
11531153
Node* newNode(T payload)
11541154
in {
11551155
assert(freeList, "Uninitialized StackTree!(" ~ T.stringof ~ ")");
1156-
} body {
1156+
} do {
11571157
Node* ret;
11581158
if(*freeList !is null) {
11591159
ret = popFreeList();

source/dstats/base.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ private void averageTies(T, U)(T sortedInput, U[] ranks, size_t[] perms)
530530
in {
531531
assert(sortedInput.length == ranks.length);
532532
assert(ranks.length == perms.length);
533-
} body {
533+
} do {
534534
size_t tieCount = 1;
535535
foreach(i; 1..ranks.length) {
536536
if(sortedInput[i] == sortedInput[i - 1]) {
@@ -856,7 +856,7 @@ unittest {
856856
double logNcomb(ulong n, ulong k)
857857
in {
858858
assert(k <= n);
859-
} body {
859+
} do {
860860
if(n < k) return -double.infinity;
861861
//Extra parentheses increase numerical accuracy.
862862
return logFactorial(n) - (logFactorial(k) + logFactorial(n - k));
@@ -1220,7 +1220,7 @@ public:
12201220
this(uint n, uint r)
12211221
in {
12221222
assert(n >= r);
1223-
} body {
1223+
} do {
12241224
if(r > 0) {
12251225
pos = (seq(0U, r)).ptr;
12261226
pos[r - 1]--;

source/dstats/cor.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ package KendallLowLevel kendallCorDestructiveLowLevelImpl
589589
(R1, R2)(R1 input1, R2 input2, bool needTies)
590590
in {
591591
assert(input1.length == input2.length);
592-
} body {
592+
} do {
593593
static ulong getMs(V)(V data) { //Assumes data is sorted.
594594
ulong Ms = 0, tieCount = 0;
595595
foreach(i; 1..data.length) {
@@ -707,7 +707,7 @@ in {
707707
// implementation exists in this module for large N, but when N gets this
708708
// large it's not even correct due to overflow errors.
709709
assert(input1.length < 1 << 15);
710-
} body {
710+
} do {
711711
int m1 = 0, m2 = 0;
712712
int s = 0;
713713

@@ -1259,7 +1259,7 @@ private void dotMatrix(Matrix)(
12591259
}
12601260

12611261
assert(ret.rows == rows.length);
1262-
} body {
1262+
} do {
12631263
// HACK: Before the multithreaded portion of this algorithm
12641264
// starts, make sure that there's no need to unshare ret if it's
12651265
// using ref-counted COW semantics.

source/dstats/distrib.d

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ enum POISSON_NORMAL = 1UL << 12; // Where to switch to normal approx.
228228
private double normApproxPoisCDF(ulong k, double lambda)
229229
in {
230230
assert(lambda > 0);
231-
} body {
231+
} do {
232232
double sd = sqrt(lambda);
233233
// mean == lambda.
234234
return normalCDF(k + 0.5L, lambda, sd);
@@ -278,7 +278,7 @@ unittest {
278278
private double normApproxPoisCDFR(ulong k, double lambda)
279279
in {
280280
assert(lambda > 0);
281-
} body {
281+
} do {
282282
double sd = sqrt(lambda);
283283
// mean == lambda.
284284
return normalCDFR(k - 0.5L, lambda, sd);
@@ -403,7 +403,7 @@ private double normApproxBinomCDF(double k, double n, double p)
403403
in {
404404
assert(k <= n);
405405
assert(p >= 0 && p <= 1);
406-
} body {
406+
} do {
407407
double mu = p * n;
408408
double sd = sqrt( to!double(n) ) * sqrt(p) * sqrt(1 - p);
409409
double xCC = k + 0.5L;
@@ -482,7 +482,7 @@ private double normApproxBinomCDFR(ulong k, ulong n, double p)
482482
in {
483483
assert(k <= n);
484484
assert(p >= 0 && p <= 1);
485-
} body {
485+
} do {
486486
double mu = p * n;
487487
double sd = sqrt( to!double(n) ) * sqrt(p) * sqrt(1 - p);
488488
double xCC = k - 0.5L;
@@ -622,7 +622,7 @@ unittest {
622622
double hypergeometricPMF(long x, long n1, long n2, long n)
623623
in {
624624
assert(x <= n);
625-
} body {
625+
} do {
626626
if(x > n1 || x < (n - n2)) {
627627
return 0;
628628
}

source/dstats/regress.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ private void shermanMorrisonRidge(
13041304
assert(lambda > 0);
13051305
foreach(col; x) assert(col.length == x[0].length);
13061306
if(x.length) assert(y.length == x[0].length);
1307-
} body {
1307+
} do {
13081308
auto alloc = newRegionAllocator();
13091309
immutable p = x.length;
13101310
if(p == 0) return;
@@ -2800,7 +2800,7 @@ private double threeDot(
28002800
) in {
28012801
assert(x1.length == x2.length);
28022802
assert(x2.length == x3.length);
2803-
} body {
2803+
} do {
28042804
immutable n = x1.length;
28052805
auto avec = x1.ptr, bvec = x2.ptr, cvec = x3.ptr;
28062806
typeof(return) sum0 = 0, sum1 = 0;

source/dstats/sort.d

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ in {
344344
foreach(array; data[1..$]) {
345345
assert(array.length == len);
346346
}
347-
} body {
347+
} do {
348348
if(data[0].length < 25) {
349349
// Skip computing logarithm rather than waiting until qsortImpl to
350350
// do this.
@@ -481,7 +481,7 @@ in {
481481
static if(!is(typeof(array) == ulong*))
482482
assert(array.length == len);
483483
}
484-
} body {
484+
} do {
485485
if(data[0].length < 65) { //Avoid mem allocation.
486486
return insertionSortImpl!(compFun)(data);
487487
}
@@ -602,7 +602,7 @@ in {
602602
static if(!is(typeof(array) == ulong*))
603603
assert(array.length == len);
604604
}
605-
} body {
605+
} do {
606606
static if(is(T[$ - 1] == ulong*)) {
607607
enum dl = data.length - 1;
608608
} else {
@@ -737,7 +737,7 @@ in {
737737
foreach(array; data[1..$]) {
738738
assert(array.length == len);
739739
}
740-
} body {
740+
} do {
741741
auto toSort = prepareForSorting!compFun(data[0]);
742742
mergeSortInPlaceImpl!compFun(toSort, data[1..$]);
743743
postProcess!compFun(data[0]);
@@ -854,7 +854,7 @@ in {
854854
foreach(array; data[1..$]) {
855855
assert(array.length == len);
856856
}
857-
} body {
857+
} do {
858858
auto toSort = prepareForSorting!compFun(data[0]);
859859
heapSortImpl!compFun(toSort, data[1..$]);
860860
postProcess!compFun(data[0]);
@@ -944,7 +944,7 @@ in {
944944
static if(!is(typeof(array) == ulong*))
945945
assert(array.length == len);
946946
}
947-
} body {
947+
} do {
948948
auto toSort = prepareForSorting!compFun(data[0]);
949949
insertionSortImpl!compFun(toSort, data[1..$]);
950950
postProcess!compFun(data[0]);
@@ -1111,7 +1111,7 @@ in {
11111111
foreach(array; data[1..$]) {
11121112
assert(array.length == len);
11131113
}
1114-
} body {
1114+
} do {
11151115
// Don't use the float-to-int trick because it's actually slower here
11161116
// because the main part of the algorithm is O(N), not O(N log N).
11171117
return partitionKImpl!compFun(data, k);
@@ -1293,4 +1293,3 @@ unittest {
12931293
assert(more.getSorted == qsort!("a > b")(nums[0..5]));
12941294
}
12951295
}
1296-

source/dstats/tests.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ private double wilcoxonSignedRankPval(double W, ulong N, Alt alt = Alt.twoSided,
17301730
in {
17311731
assert(N > 0);
17321732
assert(tieSum >= 0 || isNaN(tieSum));
1733-
} body {
1733+
} do {
17341734
if(alt == Alt.none) {
17351735
return double.nan;
17361736
}
@@ -3146,15 +3146,15 @@ private double ksPval(ulong N, ulong Nprime, double D)
31463146
in {
31473147
assert(D >= -1);
31483148
assert(D <= 1);
3149-
} body {
3149+
} do {
31503150
return 1 - kolmogorovDistrib(sqrt(cast(double) (N * Nprime) / (N + Nprime)) * abs(D));
31513151
}
31523152

31533153
private double ksPval(ulong N, double D)
31543154
in {
31553155
assert(D >= -1);
31563156
assert(D <= 1);
3157-
} body {
3157+
} do {
31583158
return 1 - kolmogorovDistrib(abs(D) * sqrt(cast(double) N));
31593159
}
31603160

0 commit comments

Comments
 (0)