Skip to content

Commit cb42154

Browse files
committed
Refactor: use _ prefix for private fields in ParameterData
Renamed all private backing fields in ParameterData.cs to use the C# convention of an underscore prefix (e.g., _isRef instead of isRef). Updated all property implementations to reference the new field names. No functional changes; this is a naming consistency refactor.
1 parent 6ea08a7 commit cb42154

1 file changed

Lines changed: 36 additions & 36 deletions

File tree

‎src/BionicCode.Utilities.Reflection/ParameterData.cs‎

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818
/// Instances of this class are typically created based on a ParameterInfo object from the <see cref="SymbolReflectionInfoCache"/> API.</remarks>
1919
internal sealed class ParameterData : SymbolInfoData
2020
{
21-
private SymbolAttributes symbolAttributes;
22-
private IList<CustomAttributeData>? attributeData;
23-
private bool? isRef;
24-
private bool? isRefReadOnly;
25-
private bool? isByRef;
26-
private bool? isIn;
27-
private bool? isOut;
28-
private bool? isOptional;
29-
private bool? isParams;
30-
private TypeData? parameterTypeData;
31-
private TypeData? declaringTypeData;
32-
private ParameterizedMemberData? member;
33-
private string? assemblyName;
34-
private SymbolComponentInfo? symbolComponentInfo;
21+
private SymbolAttributes _symbolAttributes;
22+
private IList<CustomAttributeData>? _attributeData;
23+
private bool? _isRef;
24+
private bool? _isRefReadOnly;
25+
private bool? _isByRef;
26+
private bool? _isIn;
27+
private bool? _isOut;
28+
private bool? _isOptional;
29+
private bool? _isParams;
30+
private TypeData? _parameterTypeData;
31+
private TypeData? _declaringTypeData;
32+
private ParameterizedMemberData? _member;
33+
private string? _assemblyName;
34+
private SymbolComponentInfo? _symbolComponentInfo;
3535
private object? _defaultValue;
36-
private ParameterKind? parameterKind;
37-
private bool? isGenericTypeParameter;
38-
private bool? isGenericMethodParameter;
36+
private ParameterKind? _parameterKind;
37+
private bool? _isGenericTypeParameter;
38+
private bool? _isGenericMethodParameter;
3939
private bool? _isIndexerPropertyParameter;
4040
private RuntimeTypeHandle? _declaringTypeHandle;
4141
private RuntimeTypeHandle? _propertyTypeHandle;
@@ -69,28 +69,28 @@ internal RuntimeTypeHandle ParameterTypeHandle
6969
/// </summary>
7070
/// <value><see langword="true"/> if the parameter is passed by reference using the <c>ref</c> keyword; otherwise, <see langword="false"/>.</value>
7171
internal bool IsRef
72-
=> isRef ??= IsRefInternal(this);
72+
=> _isRef ??= IsRefInternal(this);
7373

7474
/// <summary>
7575
/// Gets a value indicating whether the current instance is marked as <see langword="ref"/> <see langword="readonly"/>.
7676
/// </summary>
7777
/// <value><see langword="true"/> if the parameter is marked as <see langword="ref"/> <see langword="readonly"/>; otherwise, <see langword="false"/>.</value>
7878
internal bool IsRefReadOnly
79-
=> isRefReadOnly ??= IsRefReadOnlyInternal(this);
79+
=> _isRefReadOnly ??= IsRefReadOnlyInternal(this);
8080

8181
/// <summary>
8282
/// Gets a value indicating whether the parameter is an input parameter (passed by reference using the <see langword="in"/> keyword).
8383
/// </summary>
8484
/// <value><see langword="true"/> if the parameter is an input parameter; otherwise, <see langword="false"/>.</value>
8585
internal bool IsIn
86-
=> isIn ??= IsInParameter(this);
86+
=> _isIn ??= IsInParameter(this);
8787

8888
/// <summary>
8989
/// Gets a value indicating whether the parameter is an output parameter (passed by reference using the <see langword="out"/> keyword.
9090
/// </summary>
9191
/// <value><see langword="true"/> if the parameter is an output parameter; otherwise, <see langword="false"/>.</value>
9292
internal bool IsOut
93-
=> isOut ??= IsOutParameter(this);
93+
=> _isOut ??= IsOutParameter(this);
9494

9595
/// <summary>
9696
/// Gets a value indicating whether the parameter is optional.
@@ -99,23 +99,23 @@ internal bool IsOut
9999
/// <remarks>This property does not return whether the parameter is decorated with the <see cref="System.Runtime.InteropServices.OptionalAttribute"/>.
100100
/// It only checks whether the parameter is considered optional by the existence of a default value by reading <see cref="System.Reflection.ParameterInfo.HasDefaultValue"/>.</remarks>
101101
internal bool IsOptional
102-
=> isOptional ??= GetParameterInfo().HasDefaultValue;
102+
=> _isOptional ??= GetParameterInfo().HasDefaultValue;
103103

104104
/// <summary>
105105
/// Gets a value indicating whether the parameter type is a generic type parameter.
106106
/// </summary>
107107
/// <value><see langword="true"/> if the parameter type is a generic type parameter; otherwise, <see langword="false"/>.</value>
108108
internal bool IsGenericTypeParameter
109-
=> isGenericTypeParameter ??= ParameterTypeData.IsGenericTypeParameter;
109+
=> _isGenericTypeParameter ??= ParameterTypeData.IsGenericTypeParameter;
110110

111111
internal bool IsGenericMethodParameter
112-
=> isGenericMethodParameter ??= ParameterTypeData.IsGenericMethodParameter;
112+
=> _isGenericMethodParameter ??= ParameterTypeData.IsGenericMethodParameter;
113113

114114
/// <summary>
115115
/// The modifier that indicates how the parameter is passed (e.g., by value, by reference, as an input parameter, or as an output parameter).
116116
/// </summary>
117117
internal ParameterKind ParameterKind
118-
=> parameterKind ??= IsIn
118+
=> _parameterKind ??= IsIn
119119
? ParameterKind.In
120120
: IsOut
121121
? ParameterKind.Out
@@ -146,7 +146,7 @@ internal int Position
146146
=> _position ??= GetParameterInfo().Position;
147147

148148
internal bool IsParams
149-
=> isParams ??= GetParameterInfo().GetCustomAttribute<ParamArrayAttribute>() != null;
149+
=> _isParams ??= GetParameterInfo().GetCustomAttribute<ParamArrayAttribute>() != null;
150150

151151
internal ParameterInfo ParameterInfo { get; }
152152

@@ -170,7 +170,7 @@ internal bool IsParams
170170
/// If parameter association for indexer properties matters, then always obtain parameters directly from the getter or setter method (e.g. <see cref="MethodData.Parameters"/> like <c>PropertyData.PropertySetMethodData.Parameters</c>) and completely avoid <see cref="PropertyData.IndexerParameters"/> (or <see cref="PropertyInfo.GetIndexParameters"/>).</remarks>
171171
/// <value>The <see cref="ParameterizedMemberData"/> (which is either a <see cref="MethodData"/> or <see cref="ConstructorData"/>) that declares this parameter.</value>
172172
internal ParameterizedMemberData MemberData
173-
=> member ??= GetParameterInfo().Member switch
173+
=> _member ??= GetParameterInfo().Member switch
174174
{
175175
ConstructorInfo constructorInfo => SymbolReflectionInfoCache.GetOrCreateSymbolReflectionInfoCacheEntry(constructorInfo),
176176

@@ -190,19 +190,19 @@ internal ParameterizedMemberData MemberData
190190
};
191191

192192
internal TypeData ParameterTypeData
193-
=> parameterTypeData ??= SymbolReflectionInfoCache.GetOrCreateSymbolInfoDataCacheEntry(GetParameterInfo().ParameterType);
193+
=> _parameterTypeData ??= SymbolReflectionInfoCache.GetOrCreateSymbolInfoDataCacheEntry(GetParameterInfo().ParameterType);
194194

195195
internal TypeData DeclaringTypeData
196-
=> declaringTypeData ??= SymbolReflectionInfoCache.GetOrCreateSymbolInfoDataCacheEntry(GetDeclaringType());
196+
=> _declaringTypeData ??= SymbolReflectionInfoCache.GetOrCreateSymbolInfoDataCacheEntry(GetDeclaringType());
197197

198198
internal override IList<CustomAttributeData> AttributeData
199-
=> attributeData ??= [.. GetParameterInfo().GetCustomAttributesData()];
199+
=> _attributeData ??= [.. GetParameterInfo().GetCustomAttributesData()];
200200

201201
/// <summary>
202202
/// Gets a value indicating whether the parameter is passed by reference.
203203
/// </summary>
204204
internal bool IsByRef
205-
=> isByRef ??= ParameterTypeData.UnwrapType().IsByRef;
205+
=> _isByRef ??= ParameterTypeData.UnwrapType().IsByRef;
206206

207207
internal bool IsIndexerPropertyParameter
208208
=> _isIndexerPropertyParameter ??= MemberData is MethodData methodData && (methodData.IsIndexerPropertyGetMethod || methodData.IsIndexerPropertySetMethod);
@@ -246,12 +246,12 @@ internal bool IsSetterValueParameter
246246
internal bool IsPropertySetterParameter
247247
=> _isPropertySetterParameter ??= MemberData is MethodData methodData && methodData.IsPropertySetMethod;
248248

249-
internal override SymbolAttributes SymbolAttributes => symbolAttributes is SymbolAttributes.Undefined
250-
? (symbolAttributes = ParameterData.GetAttributesInternal(this))
251-
: symbolAttributes;
249+
internal override SymbolAttributes SymbolAttributes => _symbolAttributes is SymbolAttributes.Undefined
250+
? (_symbolAttributes = ParameterData.GetAttributesInternal(this))
251+
: _symbolAttributes;
252252

253253
internal override SymbolComponentInfo SymbolComponentInfo
254-
=> symbolComponentInfo ??= SymbolSignatureGenerator.ToSignatureComponentsInternal(this, isFullyQualifiedName: false, isDeclaringTypeIncluded: false, isCompact: false);
254+
=> _symbolComponentInfo ??= SymbolSignatureGenerator.ToSignatureComponentsInternal(this, isFullyQualifiedName: false, isDeclaringTypeIncluded: false, isCompact: false);
255255

256256
internal override string Signature
257257
=> Name;
@@ -287,7 +287,7 @@ internal override string FullyQualifiedDisplayName
287287
=> Name;
288288

289289
internal override string AssemblyName
290-
=> assemblyName ??= MemberData.AssemblyName;
290+
=> _assemblyName ??= MemberData.AssemblyName;
291291

292292
internal override string Namespace { get; }
293293

0 commit comments

Comments
 (0)