Skip to content

Commit

Permalink
less each calls
Browse files Browse the repository at this point in the history
  • Loading branch information
burner committed Apr 14, 2021
1 parent c9e780a commit 90579d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion source/graphql/schema/toschemafile.d
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ inout(GQLDType)[string] allMember(inout(GQLDMap) m) {
GQLDType[string] ret;

void process(GQLDMap m) {
m.member.byPair.each!((k,v) => ret.require(k,v));
foreach(k,v; m.member.byPair) {
ret.require(k,v);
}

if(auto o = cast(GQLDObject)m) {
if(o.base) {
Expand Down
8 changes: 5 additions & 3 deletions source/graphql/validation/querybased.d
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,16 @@ bool[string] computeVariablesUsedByFragments(bool[string] fragmentsUsed,
string[string] variablesUsed)
{
bool[string] ret;
fragmentsUsed
foreach(a; fragmentsUsed
.byKey()
.filter!(a => a in variablesUsed)
.map!(a => variablesUsed[a])
.array
.sort
.uniq
.each!(a => ret[a] = true);
.uniq)
{
ret[a] = true;
}
return ret;
}

Expand Down

0 comments on commit 90579d9

Please sign in to comment.