Skip to content

Commit 6dfe90e

Browse files
committed
C#: Change array-returning properties
1 parent 7721c7b commit 6dfe90e

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

csharp/autobuilder/Semmle.Autobuild.CSharp/StandaloneBuildRule.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Semmle.Autobuild.Shared;
1+
using System.Linq;
2+
using Semmle.Autobuild.Shared;
23

34
namespace Semmle.Autobuild.CSharp
45
{
@@ -44,9 +45,7 @@ BuildScript GetCommand(string? solution)
4445
if (!builder.Options.Buildless)
4546
return BuildScript.Failure;
4647

47-
var solutions = builder.Options.Solution.Length;
48-
49-
if (solutions == 0)
48+
if (!builder.Options.Solution.Any())
5049
return GetCommand(null);
5150

5251
var script = BuildScript.Success;

csharp/autobuilder/Semmle.Autobuild.Shared/AutobuildOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Linq;
34
using System.Text.RegularExpressions;
45

@@ -21,7 +22,7 @@ public class AutobuildOptions
2122
public string? DotNetArguments { get; }
2223
public string? DotNetVersion { get; }
2324
public string? BuildCommand { get; }
24-
public string[] Solution { get; }
25+
public IEnumerable<string> Solution { get; }
2526
public bool IgnoreErrors { get; }
2627
public bool Buildless { get; }
2728
public bool AllSolutions { get; }

csharp/extractor/Semmle.Extraction.CSharp/Analyser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public Analyser(IProgressMonitor pm, ILogger logger, bool addAssemblyTrapPrefix,
5252
/// </summary>
5353
/// <param name="roslynArgs">The arguments passed to Roslyn.</param>
5454
/// <returns>A Boolean indicating whether to proceed with extraction.</returns>
55-
public bool BeginInitialize(string[] roslynArgs)
55+
public bool BeginInitialize(IEnumerable<string> roslynArgs)
5656
{
5757
return init = LogRoslynArgs(roslynArgs, Extraction.Extractor.Version);
5858
}
@@ -447,7 +447,7 @@ public void LogExtractorInfo(string extractorVersion)
447447
/// </summary>
448448
/// <param name="roslynArgs">The arguments passed to Roslyn.</param>
449449
/// <returns>A Boolean indicating whether the same arguments have been logged previously.</returns>
450-
public bool LogRoslynArgs(string[] roslynArgs, string extractorVersion)
450+
private bool LogRoslynArgs(IEnumerable<string> roslynArgs, string extractorVersion)
451451
{
452452
LogExtractorInfo(extractorVersion);
453453
Logger.Log(Severity.Info, $" Arguments to Roslyn: {string.Join(' ', roslynArgs)}");

csharp/extractor/Semmle.Extraction.CSharp/CompilerVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@ private static bool SuppressDefaultResponseFile(IEnumerable<string> args)
134134
return args.Any(arg => new[] { "/noconfig", "-noconfig" }.Contains(arg.ToLowerInvariant()));
135135
}
136136

137-
public string[] ArgsWithResponse { get; }
137+
public IEnumerable<string> ArgsWithResponse { get; }
138138
}
139139
}

csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/Nullability.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public sealed class Nullability
1010
public int Annotation { get; }
1111

1212
private static readonly Nullability[] emptyArray = System.Array.Empty<Nullability>();
13-
public Nullability[] NullableParameters { get; }
13+
public IEnumerable<Nullability> NullableParameters { get; }
1414

1515
public static Nullability Create(AnnotatedTypeSymbol ts)
1616
{
@@ -30,7 +30,7 @@ public static Nullability Create(AnnotatedTypeSymbol ts)
3030
return new Nullability(ts);
3131
}
3232

33-
public bool IsOblivious => Annotation == 0 && NullableParameters.Length == 0;
33+
public bool IsOblivious => Annotation == 0 && !NullableParameters.Any();
3434

3535
private static readonly Nullability oblivious = new Nullability(NullableAnnotation.None);
3636
private static readonly Nullability annotated = new Nullability(NullableAnnotation.Annotated);

0 commit comments

Comments
 (0)