Skip to content

Commit

Permalink
Delete some dead code in CoreLib (dotnet#97504)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalStrehovsky authored Jan 25, 2024
1 parent f479ea1 commit f86af94
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,34 +151,5 @@ public static Attribute Instantiate(this CustomAttributeData cad)
return array;
}
}

//
// Only public instance fields can be targets of named arguments.
//
private static bool IsValidNamedArgumentTarget(this FieldInfo fieldInfo)
{
if ((fieldInfo.Attributes & (FieldAttributes.FieldAccessMask | FieldAttributes.Static | FieldAttributes.Literal)) !=
FieldAttributes.Public)
return false;
return true;
}

//
// Only public read/write instance properties can be targets of named arguments.
//
private static bool IsValidNamedArgumentTarget(this PropertyInfo propertyInfo)
{
MethodInfo? getter = propertyInfo.GetMethod;
MethodInfo? setter = propertyInfo.SetMethod;
if (getter == null)
return false;
if ((getter.Attributes & (MethodAttributes.Static | MethodAttributes.MemberAccessMask)) != MethodAttributes.Public)
return false;
if (setter == null)
return false;
if ((setter.Attributes & (MethodAttributes.Static | MethodAttributes.MemberAccessMask)) != MethodAttributes.Public)
return false;
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ public sealed class ConstructorInvoker
{
private readonly MethodBaseInvoker _methodBaseInvoker;
private readonly int _parameterCount;
private readonly RuntimeTypeHandle _declaringTypeHandle;

internal ConstructorInvoker(RuntimeConstructorInfo constructor)
{
_methodBaseInvoker = constructor.MethodInvoker;
_parameterCount = constructor.GetParametersAsSpan().Length;
_declaringTypeHandle = constructor.DeclaringType.TypeHandle;
}

public static ConstructorInvoker Create(ConstructorInfo constructor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ namespace System.Reflection.Runtime.ParameterInfos.NativeFormat
//-----------------------------------------------------------------------------------------------------------
internal sealed partial class NativeFormatMethodParameterInfo
{
internal static NativeFormatMethodParameterInfo GetNativeFormatMethodParameterInfo(MethodBase member, MethodHandle methodHandle, int position, ParameterHandle parameterHandle, QSignatureTypeHandle qualifiedParameterType, TypeContext typeContext)
internal static NativeFormatMethodParameterInfo GetNativeFormatMethodParameterInfo(MethodBase member, int position, ParameterHandle parameterHandle, QSignatureTypeHandle qualifiedParameterType, TypeContext typeContext)
{
return new NativeFormatMethodParameterInfo(member, methodHandle, position, parameterHandle, qualifiedParameterType, typeContext);
return new NativeFormatMethodParameterInfo(member, position, parameterHandle, qualifiedParameterType, typeContext);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void FillInMetadataDescribedParameters(ref VirtualRuntimeParameterInfoArr
result[index] =
NativeFormatMethodParameterInfo.GetNativeFormatMethodParameterInfo(
contextMethod,
_methodHandle,
index - 1,
parameterHandle,
typeSignatures[index],
Expand Down Expand Up @@ -244,7 +243,6 @@ public RuntimeParameterInfo[] GetRuntimeParameters(MethodBase contextMethod, Run
result[index] =
NativeFormatMethodParameterInfo.GetNativeFormatMethodParameterInfo(
contextMethod,
_methodHandle,
index - 1,
parameterHandle,
new QSignatureTypeHandle(reader, typeSignatures[index]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ namespace System.Reflection.Runtime.ParameterInfos.NativeFormat
//
internal sealed partial class NativeFormatMethodParameterInfo : RuntimeFatMethodParameterInfo
{
private NativeFormatMethodParameterInfo(MethodBase member, MethodHandle methodHandle, int position, ParameterHandle parameterHandle, QSignatureTypeHandle qualifiedParameterTypeHandle, TypeContext typeContext)
private NativeFormatMethodParameterInfo(MethodBase member, int position, ParameterHandle parameterHandle, QSignatureTypeHandle qualifiedParameterTypeHandle, TypeContext typeContext)
: base(member, position, qualifiedParameterTypeHandle, typeContext)
{
_methodHandle = methodHandle;
_parameterHandle = parameterHandle;
_parameter = parameterHandle.GetParameter(Reader);
}

Expand Down Expand Up @@ -69,8 +67,6 @@ protected sealed override bool GetDefaultValueIfAvailable(bool raw, out object?
|| DefaultValueParser.GetDefaultValueFromAttributeIfAny(CustomAttributes, raw, out defaultValue);
}

private readonly MethodHandle _methodHandle;
private readonly ParameterHandle _parameterHandle;
private readonly Parameter _parameter;
}
}

0 comments on commit f86af94

Please sign in to comment.