Skip to content

Commit b03e87f

Browse files
authored
Merge pull request github#3379 from calumgrant/cs/nullability-warning
C#: Remove nullability warnings
2 parents 2b055de + 86d032e commit b03e87f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

csharp/autobuilder/Semmle.Autobuild/Autobuilder.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,24 @@ void FindFiles(string dir, int depth, int maxDepth, IList<(string, int)> results
118118
/// </summary>
119119
public IBuildActions Actions { get; }
120120

121+
IEnumerable<IProjectOrSolution>? FindFiles(string extension, Func<string, ProjectOrSolution> create)
122+
{
123+
var matchingFiles = GetExtensions(extension).
124+
Select(p => (ProjectOrSolution: create(p.Item1), DistanceFromRoot: p.Item2)).
125+
Where(p => p.ProjectOrSolution.HasLanguage(this.Options.Language)).
126+
ToArray();
127+
128+
if (matchingFiles.Length == 0)
129+
return null;
130+
131+
if (Options.AllSolutions)
132+
return matchingFiles.Select(p => p.ProjectOrSolution);
133+
134+
return matchingFiles.
135+
Where(f => f.DistanceFromRoot == matchingFiles[0].DistanceFromRoot).
136+
Select(f => f.ProjectOrSolution);
137+
}
138+
121139
/// <summary>
122140
/// Find all the relevant files and picks the best
123141
/// solution file and tools.
@@ -151,24 +169,6 @@ public Autobuilder(IBuildActions actions, AutobuildOptions options)
151169
return ret;
152170
}
153171

154-
IEnumerable<IProjectOrSolution>? FindFiles(string extension, Func<string, ProjectOrSolution> create)
155-
{
156-
var matchingFiles = GetExtensions(extension).
157-
Select(p => (ProjectOrSolution: create(p.Item1), DistanceFromRoot: p.Item2)).
158-
Where(p => p.ProjectOrSolution.HasLanguage(this.Options.Language)).
159-
ToArray();
160-
161-
if (matchingFiles.Length == 0)
162-
return null;
163-
164-
if (options.AllSolutions)
165-
return matchingFiles.Select(p => p.ProjectOrSolution);
166-
167-
return matchingFiles.
168-
Where(f => f.DistanceFromRoot == matchingFiles[0].DistanceFromRoot).
169-
Select(f => f.ProjectOrSolution);
170-
}
171-
172172
// First look for `.proj` files
173173
ret = FindFiles(".proj", f => new Project(this, f))?.ToList();
174174
if (ret != null)

0 commit comments

Comments
 (0)