mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C#: Address review comments. Create a TNullability type annotation and restructure TAnnotation.
This commit is contained in:
@@ -7,14 +7,14 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
public sealed class Nullability
|
||||
{
|
||||
public int Annotation { get; private set; }
|
||||
public int Annotation { get; }
|
||||
|
||||
static readonly Nullability[] EmptyArray = new Nullability[0];
|
||||
public readonly Nullability[] NullableParameters;
|
||||
|
||||
public static Nullability Create(AnnotatedTypeSymbol ts)
|
||||
{
|
||||
if(ts.HasConsistentNullability())
|
||||
if (ts.HasConsistentNullability())
|
||||
{
|
||||
switch (ts.Nullability)
|
||||
{
|
||||
@@ -35,12 +35,6 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
static readonly Nullability notannotated = new Nullability(NullableAnnotation.NotAnnotated);
|
||||
|
||||
private Nullability(NullableAnnotation n)
|
||||
{
|
||||
SetNullability(n);
|
||||
NullableParameters = new Nullability[0];
|
||||
}
|
||||
|
||||
private void SetNullability(NullableAnnotation n)
|
||||
{
|
||||
switch (n)
|
||||
{
|
||||
@@ -54,6 +48,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
Annotation = 0;
|
||||
break;
|
||||
}
|
||||
NullableParameters = EmptyArray;
|
||||
}
|
||||
|
||||
private Nullability(AnnotatedTypeSymbol ts) : this(ts.Nullability)
|
||||
|
||||
Reference in New Issue
Block a user