mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
C#: Remove nullability warning by lifting local function. Warning seems to be caused by a compiler bug.
This commit is contained in:
@@ -118,6 +118,24 @@ namespace Semmle.Autobuild
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IBuildActions Actions { get; }
|
public IBuildActions Actions { get; }
|
||||||
|
|
||||||
|
IEnumerable<IProjectOrSolution>? FindFiles(string extension, Func<string, ProjectOrSolution> create)
|
||||||
|
{
|
||||||
|
var matchingFiles = GetExtensions(extension).
|
||||||
|
Select(p => (ProjectOrSolution: create(p.Item1), DistanceFromRoot: p.Item2)).
|
||||||
|
Where(p => p.ProjectOrSolution.HasLanguage(this.Options.Language)).
|
||||||
|
ToArray();
|
||||||
|
|
||||||
|
if (matchingFiles.Length == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (Options.AllSolutions)
|
||||||
|
return matchingFiles.Select(p => p.ProjectOrSolution);
|
||||||
|
|
||||||
|
return matchingFiles.
|
||||||
|
Where(f => f.DistanceFromRoot == matchingFiles[0].DistanceFromRoot).
|
||||||
|
Select(f => f.ProjectOrSolution);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find all the relevant files and picks the best
|
/// Find all the relevant files and picks the best
|
||||||
/// solution file and tools.
|
/// solution file and tools.
|
||||||
@@ -151,24 +169,6 @@ namespace Semmle.Autobuild
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<IProjectOrSolution>? FindFiles(string extension, Func<string, ProjectOrSolution> create)
|
|
||||||
{
|
|
||||||
var matchingFiles = GetExtensions(extension).
|
|
||||||
Select(p => (ProjectOrSolution: create(p.Item1), DistanceFromRoot: p.Item2)).
|
|
||||||
Where(p => p.ProjectOrSolution.HasLanguage(this.Options.Language)).
|
|
||||||
ToArray();
|
|
||||||
|
|
||||||
if (matchingFiles.Length == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (options.AllSolutions)
|
|
||||||
return matchingFiles.Select(p => p.ProjectOrSolution);
|
|
||||||
|
|
||||||
return matchingFiles.
|
|
||||||
Where(f => f.DistanceFromRoot == matchingFiles[0].DistanceFromRoot).
|
|
||||||
Select(f => f.ProjectOrSolution);
|
|
||||||
}
|
|
||||||
|
|
||||||
// First look for `.proj` files
|
// First look for `.proj` files
|
||||||
ret = FindFiles(".proj", f => new Project(this, f))?.ToList();
|
ret = FindFiles(".proj", f => new Project(this, f))?.ToList();
|
||||||
if (ret != null)
|
if (ret != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user