66
77namespace Mono . Cecil
88{
9- static internal partial class TypeDefinitionExtensions
9+ public static partial class TypeDefinitionExtensions
1010 {
11- public static bool IsSubclassOf ( this TypeReference child , TypeReference parent )
11+ internal static bool IsSubclassOf ( this TypeReference child , TypeReference parent )
1212 {
1313 var typeDef = child . Resolve ( ) ;
1414 return typeDef . IsSubclassOf ( parent ) ;
1515 }
1616
17- public static bool IsSubclassOf ( this TypeDefinition child , TypeReference parent )
17+ internal static bool IsSubclassOf ( this TypeDefinition child , TypeReference parent )
1818 {
1919 if ( parent != null )
2020 {
@@ -33,7 +33,7 @@ private static IEnumerable<TypeDefinition> EnumerateBaseClasses(this TypeDefinit
3333 }
3434 }
3535
36- public static bool IsAlmostEqualTo ( this TypeReference child , TypeDefinition parent )
36+ internal static bool IsAlmostEqualTo ( this TypeReference child , TypeDefinition parent )
3737 {
3838 if ( child is GenericInstanceType genericInstanceTypeB )
3939 {
@@ -63,23 +63,23 @@ public static Type ToType(this TypeDefinition typeDefinition)
6363 var fullName = typeDefinition . FullName . RuntimeNameToReflectionName ( ) ;
6464 return Type . GetType ( string . Concat ( fullName , ", " , typeDefinition . Module . Assembly . FullName ) , true ) ;
6565 }
66-
66+
6767
6868
6969
7070
7171 /// <summary>
7272 /// Tests whether a class is immutable, i.e. all public fields are readonly and properties have no set method
7373 /// </summary>
74- public static bool IsImmutable ( this TypeDefinition typeDefinition )
74+ internal static bool IsImmutable ( this TypeDefinition typeDefinition )
7575 {
7676 var propertiesAreReadonly = typeDefinition . Properties . All ( p => p . IsReadonly ( ) ) ;
7777 var fieldsAreReadonly = typeDefinition . Fields . All ( f => f . IsReadonly ( ) ) ;
7878 var eventsAreReadonly = typeDefinition . Events . All ( f => f . IsReadonly ( ) ) ;
7979 return propertiesAreReadonly && fieldsAreReadonly && eventsAreReadonly ;
8080 }
8181
82- public static bool IsImmutableExternally ( this TypeDefinition typeDefinition )
82+ internal static bool IsImmutableExternally ( this TypeDefinition typeDefinition )
8383 {
8484 var propertiesAreReadonly = typeDefinition . Properties . All ( p => p . IsReadonlyExternally ( ) ) ;
8585 var fieldsAreReadonly = typeDefinition . Fields . All ( f => f . IsReadonlyExternally ( ) ) ;
@@ -89,21 +89,21 @@ public static bool IsImmutableExternally(this TypeDefinition typeDefinition)
8989
9090
9191
92- public static bool OnlyHasNullableMembers ( this TypeDefinition typeDefinition )
92+ internal static bool OnlyHasNullableMembers ( this TypeDefinition typeDefinition )
9393 {
9494 var propertiesAreNullable = typeDefinition . Properties . All ( p => p . IsNullable ( ) ) ;
9595 var fieldsAreNullable = typeDefinition . Fields . All ( f => f . IsNullable ( ) ) ;
9696 return propertiesAreNullable && fieldsAreNullable ;
9797 }
9898
99- public static bool OnlyHasNonNullableMembers ( this TypeDefinition typeDefinition )
99+ internal static bool OnlyHasNonNullableMembers ( this TypeDefinition typeDefinition )
100100 {
101101 var propertiesAreNonNullable = typeDefinition . Properties . All ( p => p . IsNullable ( ) == false ) ;
102102 var fieldsAreNonNullable = typeDefinition . Fields . All ( f => f . IsNullable ( ) == false ) ;
103103 return propertiesAreNonNullable && fieldsAreNonNullable ;
104104 }
105105
106- public static bool IsCompilerGenerated ( this TypeDefinition typeDefinition )
106+ internal static bool IsCompilerGenerated ( this TypeDefinition typeDefinition )
107107 {
108108 return typeDefinition . CustomAttributes . Any ( x => x ? . AttributeType ? . FullName == typeof ( CompilerGeneratedAttribute ) . FullName || x ? . AttributeType ? . FullName == typeof ( GeneratedCodeAttribute ) . FullName ) ;
109109 }
@@ -114,7 +114,7 @@ public static bool IsCompilerGenerated(this TypeDefinition typeDefinition)
114114 /// <remarks>
115115 /// For nested classes this will take the name of the declaring class. See https://github.com/BenMorris/NetArchTest/issues/73
116116 /// </remarks>
117- public static string GetNamespace ( this TypeDefinition typeDefinition )
117+ internal static string GetNamespace ( this TypeDefinition typeDefinition )
118118 {
119119 if ( typeDefinition . IsNested )
120120 {
@@ -125,7 +125,7 @@ public static string GetNamespace(this TypeDefinition typeDefinition)
125125
126126
127127
128- public static string GetNameWithoutGenericPart ( this TypeDefinition typeDefinition )
128+ internal static string GetNameWithoutGenericPart ( this TypeDefinition typeDefinition )
129129 {
130130 if ( typeDefinition . HasGenericParameters == false )
131131 {
@@ -135,21 +135,21 @@ public static string GetNameWithoutGenericPart(this TypeDefinition typeDefinitio
135135 }
136136
137137
138-
139138
140139
141- public static bool IsDelegate ( this TypeDefinition typeDefinition )
140+
141+ internal static bool IsDelegate ( this TypeDefinition typeDefinition )
142142 {
143143 return typeDefinition . IsClass && typeDefinition . BaseType ? . FullName == "System.MulticastDelegate" ;
144144 }
145- public static bool IsStruct ( this TypeDefinition typeDefinition )
145+ internal static bool IsStruct ( this TypeDefinition typeDefinition )
146146 {
147147 return typeDefinition . IsValueType && typeDefinition . BaseType ? . FullName == "System.ValueType" ;
148148 }
149149
150150
151151
152- public static string GetFilePath ( this TypeDefinition typeDefinition )
152+ internal static string GetFilePath ( this TypeDefinition typeDefinition )
153153 {
154154 if ( typeDefinition . HasMethods )
155155 {
@@ -167,7 +167,7 @@ public static string GetFilePath(this TypeDefinition typeDefinition)
167167 return null ;
168168 }
169169
170- public static bool IsStateless ( this TypeDefinition type )
170+ internal static bool IsStateless ( this TypeDefinition type )
171171 {
172172 if ( type . HasFields )
173173 {
@@ -182,7 +182,7 @@ public static bool IsStateless(this TypeDefinition type)
182182 }
183183 return true ;
184184 }
185- public static bool IsStaticless ( this TypeDefinition type )
185+ internal static bool IsStaticless ( this TypeDefinition type )
186186 {
187187 if ( type . HasFields )
188188 {
0 commit comments