Skip to content

Commit

Permalink
Address style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Quirin Schroll authored and RubyTheRoobster committed Aug 21, 2024
1 parent e261862 commit 4fd0bd2
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions std/range/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -6143,26 +6143,29 @@ private struct LockstepMixin(Ranges...)
const:
string getAlias()
{
return iq{
alias $(name) = $(implName)!(int delegate($(params.join(", "))));
}.text;
return format(q{
alias %s = %s!(int delegate(%-(%s%|, %)));
},
name, implName, params
);
}

string getImpl()
{
return iq{
int $(implName)(DG)(scope DG dg) scope
return format(q{
int %s(DG)(scope DG dg) scope
{
import std.exception : enforce;

auto ranges = this.ranges;
$(indexDef)
%s

while ($(emptyChecks.join(" && ")))
while (%-(%s%| && %))
{
if (int result = dg($(dgArgs.join(", ")))) return result;
$(popFronts.join("\n "))
$(indexInc)
if (int result = dg(%-(%s%|, %))) return result;
%-(%s%|
%)
%s
}

if (this.stoppingPolicy == StoppingPolicy.requireSameLength)
Expand All @@ -6172,7 +6175,9 @@ const:
}
return 0;
}
}.text;
},
implName, indexDef, emptyChecks, dgArgs, popFronts, indexInc
);
}
}

Expand Down Expand Up @@ -6217,22 +6222,22 @@ if (Ranges.length > 1 && allSatisfy!(isInputRange, Ranges))
this.stoppingPolicy = sp;
}

enum lockstepMixinFF = LockstepMixin!Ranges(withIndex: false, reverse: false);
private enum lockstepMixinFF = LockstepMixin!Ranges(withIndex: false, reverse: false);
mixin(lockstepMixinFF.getImpl);

enum lockstepMixinTF = LockstepMixin!Ranges(withIndex: true, reverse: false);
private enum lockstepMixinTF = LockstepMixin!Ranges(withIndex: true, reverse: false);
mixin(lockstepMixinTF.getImpl);

mixin(lockstepMixinFF.getAlias);
mixin(lockstepMixinTF.getAlias);

static if (allSatisfy!(isBidirectionalRange, Ranges))
{
enum lockstepMixinFT = LockstepMixin!Ranges(withIndex: false, reverse: true);
private enum lockstepMixinFT = LockstepMixin!Ranges(withIndex: false, reverse: true);
mixin(lockstepMixinFT.getImpl);
static if (allSatisfy!(hasLength, Ranges))
{
enum lockstepMixinTT = LockstepMixin!Ranges(withIndex: true, reverse: true);
private enum lockstepMixinTT = LockstepMixin!Ranges(withIndex: true, reverse: true);
mixin(lockstepMixinTT.getImpl);
mixin(lockstepMixinTT.getAlias);
}
Expand Down

0 comments on commit 4fd0bd2

Please sign in to comment.