public static bool AllowsNull(this PropertyDefinition property, NullGuardMode mode) { if (mode == NullGuardMode.Explicit) { return(ExplicitMode.AllowsNull(property)); } return(property.ImplicitAllowsNull()); }
public static bool AllowsNull(this ParameterDefinition parameter, MethodDefinition method, NullGuardMode mode) { if (mode == NullGuardMode.Explicit) { return(ExplicitMode.AllowsNull(parameter, method)); } return(parameter.ImplicitAllowsNull()); }
public static bool AllowsNull(this PropertyDefinition property, ExplicitMode explicitMode) { if (explicitMode != null) { return(explicitMode.AllowsNull(property)); } return(property.ImplicitAllowsNull()); }
public static bool AllowsNull(this ParameterDefinition parameter, MethodDefinition method, ExplicitMode explicitMode) { if (explicitMode != null) { return(explicitMode.AllowsNull(parameter, method)); } return(parameter.ImplicitAllowsNull()); }
public static bool AllowsNullReturnValue(this MethodDefinition methodDefinition, NullGuardMode mode) { if (mode == NullGuardMode.Explicit) { // ReSharper uses a *method* attribute for NotNull for the return value return(ExplicitMode.AllowsNull(methodDefinition)); } return(methodDefinition.MethodReturnType.CustomAttributes.Any(a => a.AttributeType.Name == AllowNullAttributeTypeName) || // ReSharper uses a *method* attribute for CanBeNull for the return value methodDefinition.CustomAttributes.Any(a => a.AttributeType.Name == CanBeNullAttributeTypeName)); }
public static bool AllowsNullReturnValue(this MethodDefinition methodDefinition, ExplicitMode explicitMode) { if (explicitMode != null) { // ReSharper uses a *method* attribute for NotNull for the return value return(explicitMode.AllowsNull(methodDefinition)); } return(methodDefinition.CustomAttributes.HasNullableReferenceType(NullableContextAttributeTypeName) || methodDefinition.MethodReturnType.CustomAttributes.Any(a => a.AttributeType.Name == AllowNullAttributeTypeName) || // ReSharper uses a *method* attribute for CanBeNull for the return value methodDefinition.CustomAttributes.Any(a => a.AttributeType.Name == CanBeNullAttributeTypeName)); }