-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New nullable reference annotation parsing code (#11)
- Loading branch information
Showing
8 changed files
with
800 additions
and
272 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace GraphQL.DI | ||
{ | ||
public enum Nullability : byte | ||
{ | ||
Unknown = 0, | ||
NonNullable = 1, | ||
Nullable = 2, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace GraphQL.DI | ||
{ | ||
internal struct NullabilityInformation | ||
{ | ||
public Nullability DefaultNullability; | ||
public Nullability[] Nullability; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
|
||
namespace GraphQL.DI | ||
{ | ||
/// <summary> | ||
/// Marks a method's (field's) return value as nullable, or | ||
/// marks a parameter's (query argument's) input value to be optional. | ||
/// </summary> | ||
//perhaps this should apply to ReturnValue instead of Method | ||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
public class OptionalListAttribute : Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
|
||
namespace GraphQL.DI | ||
{ | ||
/// <summary> | ||
/// Marks a method's (field's) return value as always non-null, or | ||
/// marks a parameter's (query argument's) input value to be required. | ||
/// </summary> | ||
//perhaps this should apply to ReturnValue instead of Method | ||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
public class RequiredListAttribute : Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using System.Text; | ||
|
||
namespace GraphQL.DI | ||
{ | ||
/// <summary> | ||
/// Contains type and nullability information for a method return type or argument type. | ||
/// </summary> | ||
public struct TypeInformation | ||
{ | ||
/// <summary> | ||
/// The argument or return parameter of the method being inspected. | ||
/// </summary> | ||
public ParameterInfo ParameterInfo; | ||
|
||
/// <summary> | ||
/// Indicates that this is an input type (an argument); false for output types. | ||
/// </summary> | ||
public bool IsInputType; | ||
|
||
/// <summary> | ||
/// The underlying type represented. This might be the underlying type of a <see cref="Nullable{T}"/> | ||
/// or the underlying type of a <see cref="IEnumerable{T}"/>. | ||
/// </summary> | ||
public Type Type; | ||
|
||
/// <summary> | ||
/// Indicates if the underlying type is nullable. | ||
/// </summary> | ||
public bool IsNullable; | ||
|
||
/// <summary> | ||
/// Indicates that this represents a list of elements. | ||
/// </summary> | ||
public bool IsList; | ||
|
||
/// <summary> | ||
/// Indicates if the list is nullable. | ||
/// </summary> | ||
public bool ListIsNullable; | ||
|
||
/// <summary> | ||
/// The graph type of the underlying CLR type. | ||
/// </summary> | ||
public Type? GraphType; | ||
|
||
/// <summary> | ||
/// Initializes an instance with the specified properties. | ||
/// </summary> | ||
/// <param name="parameterInfo">The argument or return parameter of the method being inspected.</param> | ||
/// <param name="isInputType">Indicates that this is an input type (an argument); false for output types.</param> | ||
/// <param name="type">The underlying type.</param> | ||
/// <param name="isNullable">Indicates that the underlying type is nullable.</param> | ||
/// <param name="isList">Indicates that this represents a list of elements.</param> | ||
/// <param name="listIsNullable">Indicates that the list is nullable.</param> | ||
/// <param name="graphType">The graph type of the underlying CLR type; null if not specified.</param> | ||
public TypeInformation(ParameterInfo parameterInfo, bool isInputType, Type type, bool isNullable, bool isList, bool listIsNullable, Type? graphType) | ||
{ | ||
ParameterInfo = parameterInfo; | ||
IsInputType = isInputType; | ||
Type = type; | ||
IsNullable = isNullable; | ||
IsList = isList; | ||
ListIsNullable = listIsNullable; | ||
GraphType = graphType; | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters