6
6
7
7
namespace Mono . Cecil
8
8
{
9
- static internal partial class TypeDefinitionExtensions
9
+ public static partial class TypeDefinitionExtensions
10
10
{
11
- public static bool IsSubclassOf ( this TypeReference child , TypeReference parent )
11
+ internal static bool IsSubclassOf ( this TypeReference child , TypeReference parent )
12
12
{
13
13
var typeDef = child . Resolve ( ) ;
14
14
return typeDef . IsSubclassOf ( parent ) ;
15
15
}
16
16
17
- public static bool IsSubclassOf ( this TypeDefinition child , TypeReference parent )
17
+ internal static bool IsSubclassOf ( this TypeDefinition child , TypeReference parent )
18
18
{
19
19
if ( parent != null )
20
20
{
@@ -33,7 +33,7 @@ private static IEnumerable<TypeDefinition> EnumerateBaseClasses(this TypeDefinit
33
33
}
34
34
}
35
35
36
- public static bool IsAlmostEqualTo ( this TypeReference child , TypeDefinition parent )
36
+ internal static bool IsAlmostEqualTo ( this TypeReference child , TypeDefinition parent )
37
37
{
38
38
if ( child is GenericInstanceType genericInstanceTypeB )
39
39
{
@@ -63,23 +63,23 @@ public static Type ToType(this TypeDefinition typeDefinition)
63
63
var fullName = typeDefinition . FullName . RuntimeNameToReflectionName ( ) ;
64
64
return Type . GetType ( string . Concat ( fullName , ", " , typeDefinition . Module . Assembly . FullName ) , true ) ;
65
65
}
66
-
66
+
67
67
68
68
69
69
70
70
71
71
/// <summary>
72
72
/// Tests whether a class is immutable, i.e. all public fields are readonly and properties have no set method
73
73
/// </summary>
74
- public static bool IsImmutable ( this TypeDefinition typeDefinition )
74
+ internal static bool IsImmutable ( this TypeDefinition typeDefinition )
75
75
{
76
76
var propertiesAreReadonly = typeDefinition . Properties . All ( p => p . IsReadonly ( ) ) ;
77
77
var fieldsAreReadonly = typeDefinition . Fields . All ( f => f . IsReadonly ( ) ) ;
78
78
var eventsAreReadonly = typeDefinition . Events . All ( f => f . IsReadonly ( ) ) ;
79
79
return propertiesAreReadonly && fieldsAreReadonly && eventsAreReadonly ;
80
80
}
81
81
82
- public static bool IsImmutableExternally ( this TypeDefinition typeDefinition )
82
+ internal static bool IsImmutableExternally ( this TypeDefinition typeDefinition )
83
83
{
84
84
var propertiesAreReadonly = typeDefinition . Properties . All ( p => p . IsReadonlyExternally ( ) ) ;
85
85
var fieldsAreReadonly = typeDefinition . Fields . All ( f => f . IsReadonlyExternally ( ) ) ;
@@ -89,21 +89,21 @@ public static bool IsImmutableExternally(this TypeDefinition typeDefinition)
89
89
90
90
91
91
92
- public static bool OnlyHasNullableMembers ( this TypeDefinition typeDefinition )
92
+ internal static bool OnlyHasNullableMembers ( this TypeDefinition typeDefinition )
93
93
{
94
94
var propertiesAreNullable = typeDefinition . Properties . All ( p => p . IsNullable ( ) ) ;
95
95
var fieldsAreNullable = typeDefinition . Fields . All ( f => f . IsNullable ( ) ) ;
96
96
return propertiesAreNullable && fieldsAreNullable ;
97
97
}
98
98
99
- public static bool OnlyHasNonNullableMembers ( this TypeDefinition typeDefinition )
99
+ internal static bool OnlyHasNonNullableMembers ( this TypeDefinition typeDefinition )
100
100
{
101
101
var propertiesAreNonNullable = typeDefinition . Properties . All ( p => p . IsNullable ( ) == false ) ;
102
102
var fieldsAreNonNullable = typeDefinition . Fields . All ( f => f . IsNullable ( ) == false ) ;
103
103
return propertiesAreNonNullable && fieldsAreNonNullable ;
104
104
}
105
105
106
- public static bool IsCompilerGenerated ( this TypeDefinition typeDefinition )
106
+ internal static bool IsCompilerGenerated ( this TypeDefinition typeDefinition )
107
107
{
108
108
return typeDefinition . CustomAttributes . Any ( x => x ? . AttributeType ? . FullName == typeof ( CompilerGeneratedAttribute ) . FullName || x ? . AttributeType ? . FullName == typeof ( GeneratedCodeAttribute ) . FullName ) ;
109
109
}
@@ -114,7 +114,7 @@ public static bool IsCompilerGenerated(this TypeDefinition typeDefinition)
114
114
/// <remarks>
115
115
/// For nested classes this will take the name of the declaring class. See https://github.com/BenMorris/NetArchTest/issues/73
116
116
/// </remarks>
117
- public static string GetNamespace ( this TypeDefinition typeDefinition )
117
+ internal static string GetNamespace ( this TypeDefinition typeDefinition )
118
118
{
119
119
if ( typeDefinition . IsNested )
120
120
{
@@ -125,7 +125,7 @@ public static string GetNamespace(this TypeDefinition typeDefinition)
125
125
126
126
127
127
128
- public static string GetNameWithoutGenericPart ( this TypeDefinition typeDefinition )
128
+ internal static string GetNameWithoutGenericPart ( this TypeDefinition typeDefinition )
129
129
{
130
130
if ( typeDefinition . HasGenericParameters == false )
131
131
{
@@ -135,21 +135,21 @@ public static string GetNameWithoutGenericPart(this TypeDefinition typeDefinitio
135
135
}
136
136
137
137
138
-
139
138
140
139
141
- public static bool IsDelegate ( this TypeDefinition typeDefinition )
140
+
141
+ internal static bool IsDelegate ( this TypeDefinition typeDefinition )
142
142
{
143
143
return typeDefinition . IsClass && typeDefinition . BaseType ? . FullName == "System.MulticastDelegate" ;
144
144
}
145
- public static bool IsStruct ( this TypeDefinition typeDefinition )
145
+ internal static bool IsStruct ( this TypeDefinition typeDefinition )
146
146
{
147
147
return typeDefinition . IsValueType && typeDefinition . BaseType ? . FullName == "System.ValueType" ;
148
148
}
149
149
150
150
151
151
152
- public static string GetFilePath ( this TypeDefinition typeDefinition )
152
+ internal static string GetFilePath ( this TypeDefinition typeDefinition )
153
153
{
154
154
if ( typeDefinition . HasMethods )
155
155
{
@@ -167,7 +167,7 @@ public static string GetFilePath(this TypeDefinition typeDefinition)
167
167
return null ;
168
168
}
169
169
170
- public static bool IsStateless ( this TypeDefinition type )
170
+ internal static bool IsStateless ( this TypeDefinition type )
171
171
{
172
172
if ( type . HasFields )
173
173
{
@@ -182,7 +182,7 @@ public static bool IsStateless(this TypeDefinition type)
182
182
}
183
183
return true ;
184
184
}
185
- public static bool IsStaticless ( this TypeDefinition type )
185
+ internal static bool IsStaticless ( this TypeDefinition type )
186
186
{
187
187
if ( type . HasFields )
188
188
{
0 commit comments