11// Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
4- #nullable disable
5-
64using System ;
75using System . Collections . Generic ;
86using System . Linq ;
@@ -15,45 +13,45 @@ namespace NuGet.ContentModel
1513 /// </summary>
1614 public class ContentPropertyDefinition
1715 {
18- private static readonly Func < object , object , bool > EqualsTest = ( left , right ) => Equals ( left , right ) ;
16+ private static readonly Func < object ? , object ? , bool > EqualsTest = ( left , right ) => Equals ( left , right ) ;
1917
2018 internal ContentPropertyDefinition (
2119 string name ,
22- Func < ReadOnlyMemory < char > , PatternTable , bool , object > parser )
20+ Func < ReadOnlyMemory < char > , PatternTable ? , bool , object ? > parser )
2321 : this ( name , parser , null , null , null , false )
2422 {
2523 }
2624
2725 internal ContentPropertyDefinition (
2826 string name ,
29- Func < ReadOnlyMemory < char > , PatternTable , bool , object > parser ,
30- Func < object , object , bool > compatibilityTest )
27+ Func < ReadOnlyMemory < char > , PatternTable ? , bool , object ? > parser ,
28+ Func < object ? , object ? , bool > ? compatibilityTest )
3129 : this ( name , parser , compatibilityTest , null , null , false )
3230 {
3331 }
3432
3533 internal ContentPropertyDefinition ( string name ,
36- Func < ReadOnlyMemory < char > , PatternTable , bool , object > parser ,
37- Func < object , object , bool > compatibilityTest ,
38- Func < object , object , object , int > compareTest )
34+ Func < ReadOnlyMemory < char > , PatternTable ? , bool , object ? > parser ,
35+ Func < object ? , object ? , bool > ? compatibilityTest ,
36+ Func < object ? , object ? , object ? , int > ? compareTest )
3937 : this ( name , parser , compatibilityTest , compareTest , null , false )
4038 {
4139 }
4240
4341 internal ContentPropertyDefinition (
4442 string name ,
45- Func < ReadOnlyMemory < char > , PatternTable , bool , object > parser ,
43+ Func < ReadOnlyMemory < char > , PatternTable ? , bool , object ? > parser ,
4644 IEnumerable < string > fileExtensions )
4745 : this ( name , parser , null , null , fileExtensions , false )
4846 {
4947 }
5048
5149 internal ContentPropertyDefinition (
5250 string name ,
53- Func < ReadOnlyMemory < char > , PatternTable , bool , object > parser ,
54- Func < object , object , bool > compatibilityTest ,
55- Func < object , object , object , int > compareTest ,
56- IEnumerable < string > fileExtensions ,
51+ Func < ReadOnlyMemory < char > , PatternTable ? , bool , object ? > parser ,
52+ Func < object ? , object ? , bool > ? compatibilityTest ,
53+ Func < object ? , object ? , object ? , int > ? compareTest ,
54+ IEnumerable < string > ? fileExtensions ,
5755 bool allowSubfolders )
5856 {
5957 Name = name ;
@@ -66,7 +64,7 @@ internal ContentPropertyDefinition(
6664
6765 public string Name { get ; }
6866
69- public List < string > FileExtensions { get ; }
67+ public List < string > ? FileExtensions { get ; }
7068
7169 public bool FileExtensionAllowSubFolders { get ; }
7270
@@ -76,7 +74,7 @@ internal ContentPropertyDefinition(
7674 /// If the bool is true, the return object will be non-null, and match what the ReadOnlyMemory char represents.
7775 /// If the bool is false, the return object will be non-null if the ReadOnlyMemory char represents a valid value for this definition. This is a performance optimization.
7876 /// </summary>
79- internal Func < ReadOnlyMemory < char > , PatternTable , bool , object > Parser { get ; }
77+ internal Func < ReadOnlyMemory < char > , PatternTable ? , bool , object ? > Parser { get ; }
8078
8179 /// <summary>
8280 /// Looks up a definition for the given substring.
@@ -90,7 +88,7 @@ internal ContentPropertyDefinition(
9088 /// <param name="matchOnly">Whether this is a grouping match, or we actually want to actualize the value of name as a string.</param>
9189 /// <param name="value">The out param. If matchonly, it will always be null. Otherwise, set to actualized value of name if the return is true, set to null if false.</param>
9290 /// <returns>True if the name matches the definition. False otherwise.</returns>
93- internal virtual bool TryLookup ( ReadOnlyMemory < char > name , PatternTable table , bool matchOnly , out object value )
91+ internal virtual bool TryLookup ( ReadOnlyMemory < char > name , PatternTable ? table , bool matchOnly , out object ? value )
9492 {
9593 if ( name . IsEmpty )
9694 {
@@ -148,19 +146,19 @@ private static bool ContainsSlash(ReadOnlyMemory<char> name)
148146 return containsSlash ;
149147 }
150148
151- public Func < object , object , bool > CompatibilityTest { get ; }
149+ public Func < object ? , object ? , bool > CompatibilityTest { get ; }
152150
153151 /// <summary>
154152 /// Find the nearest compatible candidate.
155153 /// </summary>
156- public Func < object , object , object , int > CompareTest { get ; }
154+ public Func < object ? , object ? , object ? , int > ? CompareTest { get ; }
157155
158- public virtual bool IsCriteriaSatisfied ( object critieriaValue , object candidateValue )
156+ public virtual bool IsCriteriaSatisfied ( object ? critieriaValue , object ? candidateValue )
159157 {
160158 return CompatibilityTest . Invoke ( critieriaValue , candidateValue ) ;
161159 }
162160
163- public virtual int Compare ( object criteriaValue , object candidateValue1 , object candidateValue2 )
161+ public virtual int Compare ( object ? criteriaValue , object ? candidateValue1 , object ? candidateValue2 )
164162 {
165163 var betterCoverageFromValue1 = IsCriteriaSatisfied ( candidateValue1 , candidateValue2 ) ;
166164 var betterCoverageFromValue2 = IsCriteriaSatisfied ( candidateValue2 , candidateValue1 ) ;
0 commit comments