Files
2026-08-27 10:56:38 -06:00

509 lines
26 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.Cci;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
internal sealed class MemberSignatureComparer : IEqualityComparer<Symbol>
{
[Flags]
private enum RefKindCompareMode
{
DoNotConsiderDifferences = 0,
ConsiderDifferences = 1,
AllowRefReadonlyVsInMismatch = 2
}
public static readonly MemberSignatureComparer ExplicitImplementationComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: true, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer CSharpImplicitImplementationComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: true, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: true, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer CSharpCloseImplicitImplementationComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: true, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer DuplicateSourceComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: true, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.DoNotConsiderDifferences, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer RecordAPISignatureComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: true, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer PartialMethodsComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: true, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer PartialMethodsStrictComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: true, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences, considerArity: true, (TypeCompareKind)16);
public static readonly MemberSignatureComparer InterceptorsComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences, considerArity: false, (TypeCompareKind)63);
public static readonly MemberSignatureComparer InterceptorsStrictComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences, considerArity: false, (TypeCompareKind)24);
public static readonly MemberSignatureComparer CSharpOverrideComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: false, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)63);
private static readonly MemberSignatureComparer CSharpWithTupleNamesComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.DoNotConsiderDifferences, considerArity: true, (TypeCompareKind)59);
private static readonly MemberSignatureComparer CSharpWithoutTupleNamesComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.DoNotConsiderDifferences, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer CSharpAccessorOverrideComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)63);
public static readonly MemberSignatureComparer CSharpCustomModifierOverrideComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)46);
internal static readonly MemberSignatureComparer SloppyOverrideComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.DoNotConsiderDifferences, considerArity: true, (TypeCompareKind)15);
public static readonly MemberSignatureComparer RuntimeSignatureComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: true, RefKindCompareMode.DoNotConsiderDifferences, considerArity: true, (TypeCompareKind)46);
public static readonly MemberSignatureComparer RuntimeExplicitImplementationSignatureComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: true, RefKindCompareMode.DoNotConsiderDifferences, considerArity: true, (TypeCompareKind)46);
public static readonly MemberSignatureComparer RuntimePlusRefOutSignatureComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: true, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)46);
public static readonly MemberSignatureComparer RuntimeImplicitImplementationComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: true, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: true, RefKindCompareMode.DoNotConsiderDifferences, considerArity: true, (TypeCompareKind)46);
public static readonly MemberSignatureComparer RetargetedExplicitImplementationComparer = new MemberSignatureComparer(considerName: true, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: true, RefKindCompareMode.ConsiderDifferences | RefKindCompareMode.AllowRefReadonlyVsInMismatch, considerArity: true, (TypeCompareKind)46);
public static readonly MemberSignatureComparer CrefComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: false, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences, considerArity: true, (TypeCompareKind)15);
internal static readonly MemberSignatureComparer MethodGroupSignatureComparer = new MemberSignatureComparer(considerName: false, considerExplicitlyImplementedInterfaces: false, considerReturnType: true, considerTypeConstraints: false, considerCallingConvention: false, RefKindCompareMode.ConsiderDifferences, considerArity: true, (TypeCompareKind)63);
private readonly bool _considerName;
private readonly bool _considerExplicitlyImplementedInterfaces;
private readonly bool _considerReturnType;
private readonly bool _considerTypeConstraints;
private readonly bool _considerArity;
private readonly bool _considerCallingConvention;
private readonly RefKindCompareMode _refKindCompareMode;
private readonly TypeCompareKind _typeComparison;
private MemberSignatureComparer(bool considerName, bool considerExplicitlyImplementedInterfaces, bool considerReturnType, bool considerTypeConstraints, bool considerCallingConvention, RefKindCompareMode refKindCompareMode, bool considerArity = true, TypeCompareKind typeComparison = (TypeCompareKind)34)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
_considerName = considerName;
_considerExplicitlyImplementedInterfaces = considerExplicitlyImplementedInterfaces;
_considerReturnType = considerReturnType;
_considerTypeConstraints = considerTypeConstraints;
_considerCallingConvention = considerCallingConvention;
_refKindCompareMode = refKindCompareMode;
_considerArity = considerArity;
_typeComparison = typeComparison;
if ((refKindCompareMode & RefKindCompareMode.ConsiderDifferences) == 0)
{
_typeComparison = (TypeCompareKind)(_typeComparison | 0x40);
}
}
public bool Equals(Symbol member1, Symbol member2)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
if ((object)member1 == member2)
{
return true;
}
if ((object)member1 == null || (object)member2 == null || member1.Kind != member2.Kind)
{
return false;
}
bool flag = false;
bool flag2 = false;
if (_considerName)
{
string memberNameWithoutInterfaceName = ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(member1.Name);
string memberNameWithoutInterfaceName2 = ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(member2.Name);
flag = memberNameWithoutInterfaceName != member1.Name;
flag2 = memberNameWithoutInterfaceName2 != member2.Name;
if (memberNameWithoutInterfaceName != memberNameWithoutInterfaceName2)
{
return false;
}
}
if (_considerArity && member1.GetMemberArity() != member2.GetMemberArity())
{
return false;
}
if (member1.GetParameterCount() != member2.GetParameterCount())
{
return false;
}
TypeMap typeMap = GetTypeMap(member1);
TypeMap typeMap2 = GetTypeMap(member2);
if (_considerReturnType && !HaveSameReturnTypes(member1, typeMap, member2, typeMap2, _typeComparison))
{
return false;
}
if (member1.GetParameterCount() > 0 && !HaveSameParameterTypes(member1.GetParameters(), typeMap, member2.GetParameters(), typeMap2, _refKindCompareMode, _typeComparison))
{
return false;
}
if (_considerCallingConvention)
{
if (GetCallingConvention(member1) != GetCallingConvention(member2))
{
return false;
}
}
else if (IsVarargMethod(member1) != IsVarargMethod(member2))
{
return false;
}
if (_considerExplicitlyImplementedInterfaces)
{
if (flag != flag2)
{
return false;
}
if (flag)
{
if (member1.IsExplicitInterfaceImplementation() != member2.IsExplicitInterfaceImplementation())
{
return false;
}
ImmutableArray<Symbol> explicitInterfaceImplementations = member1.GetExplicitInterfaceImplementations();
ImmutableArray<Symbol> explicitInterfaceImplementations2 = member2.GetExplicitInterfaceImplementations();
if (!ImmutableArrayExtensions.SetEquals<Symbol>(explicitInterfaceImplementations, explicitInterfaceImplementations2, (IEqualityComparer<Symbol>)SymbolEqualityComparer.ConsiderEverything))
{
return false;
}
}
}
if (_considerTypeConstraints)
{
return HaveSameConstraints(member1, typeMap, member2, typeMap2);
}
return true;
}
public int GetHashCode(Symbol member)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected I4, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Invalid comparison between Unknown and I4
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
int num = 1;
if ((object)member != null)
{
num = Hash.Combine((int)member.Kind, num);
if (_considerName)
{
num = Hash.Combine<string>(ExplicitInterfaceHelpers.GetMemberNameWithoutInterfaceName(member.Name), num);
}
if (_considerReturnType && member.GetMemberArity() == 0 && (_typeComparison & 0x3F) == 0)
{
num = Hash.Combine(member.GetTypeOrReturnType().GetHashCode(), num);
}
if ((int)member.Kind != 6)
{
num = Hash.Combine(member.GetMemberArity(), num);
num = Hash.Combine(member.GetParameterCount(), num);
}
}
return num;
}
private static bool HaveSameReturnTypes(Symbol member1, TypeMap typeMap1, Symbol member2, TypeMap typeMap2, TypeCompareKind typeComparison)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
member1.GetTypeOrReturnType(out RefKind refKind, out TypeWithAnnotations returnType, out ImmutableArray<CustomModifier> refCustomModifiers);
member2.GetTypeOrReturnType(out RefKind refKind2, out TypeWithAnnotations returnType2, out ImmutableArray<CustomModifier> refCustomModifiers2);
if (refKind != refKind2)
{
return false;
}
bool flag = returnType.IsVoidType();
bool flag2 = returnType2.IsVoidType();
if (flag != flag2)
{
return false;
}
if (flag && ((typeComparison & 1) != 0 || (returnType.CustomModifiers.IsEmpty && returnType2.CustomModifiers.IsEmpty)))
{
return true;
}
TypeWithAnnotations typeWithAnnotations = SubstituteType(typeMap1, returnType);
TypeWithAnnotations other = SubstituteType(typeMap2, returnType2);
if (!typeWithAnnotations.Equals(other, typeComparison))
{
return false;
}
if ((typeComparison & 1) == 0 && !HaveSameCustomModifiers(refCustomModifiers, typeMap1, refCustomModifiers2, typeMap2))
{
return false;
}
return true;
}
private static TypeMap GetTypeMap(Symbol member)
{
ImmutableArray<TypeParameterSymbol> memberTypeParameters = member.GetMemberTypeParameters();
if (!memberTypeParameters.IsEmpty)
{
return new TypeMap(memberTypeParameters, IndexedTypeParameterSymbol.Take(member.GetMemberArity()), allowAlpha: true);
}
return null;
}
private static bool HaveSameConstraints(Symbol member1, TypeMap typeMap1, Symbol member2, TypeMap typeMap2)
{
if (member1.GetMemberArity() == 0)
{
return true;
}
ImmutableArray<TypeParameterSymbol> memberTypeParameters = member1.GetMemberTypeParameters();
ImmutableArray<TypeParameterSymbol> memberTypeParameters2 = member2.GetMemberTypeParameters();
return HaveSameConstraints(memberTypeParameters, typeMap1, memberTypeParameters2, typeMap2);
}
public static bool HaveSameConstraints(ImmutableArray<TypeParameterSymbol> typeParameters1, TypeMap typeMap1, ImmutableArray<TypeParameterSymbol> typeParameters2, TypeMap typeMap2)
{
int length = typeParameters1.Length;
for (int i = 0; i < length; i++)
{
if (!HaveSameConstraints(typeParameters1[i], typeMap1, typeParameters2[i], typeMap2))
{
return false;
}
}
return true;
}
public static bool HaveSameConstraints(TypeParameterSymbol typeParameter1, TypeMap typeMap1, TypeParameterSymbol typeParameter2, TypeMap typeMap2)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (typeParameter1.HasConstructorConstraint != typeParameter2.HasConstructorConstraint || typeParameter1.HasReferenceTypeConstraint != typeParameter2.HasReferenceTypeConstraint || typeParameter1.HasValueTypeConstraint != typeParameter2.HasValueTypeConstraint || typeParameter1.HasUnmanagedTypeConstraint != typeParameter2.HasUnmanagedTypeConstraint || typeParameter1.Variance != typeParameter2.Variance)
{
return false;
}
return HaveSameTypeConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2, SymbolEqualityComparer.IgnoringDynamicTupleNamesAndNullability);
}
private static bool HaveSameTypeConstraints(TypeParameterSymbol typeParameter1, TypeMap typeMap1, TypeParameterSymbol typeParameter2, TypeMap typeMap2, IEqualityComparer<TypeSymbol> comparer)
{
ImmutableArray<TypeWithAnnotations> constraintTypesNoUseSiteDiagnostics = typeParameter1.ConstraintTypesNoUseSiteDiagnostics;
ImmutableArray<TypeWithAnnotations> constraintTypesNoUseSiteDiagnostics2 = typeParameter2.ConstraintTypesNoUseSiteDiagnostics;
if (constraintTypesNoUseSiteDiagnostics.Length == 0 && constraintTypesNoUseSiteDiagnostics2.Length == 0)
{
return true;
}
HashSet<TypeSymbol> hashSet = new HashSet<TypeSymbol>(comparer);
HashSet<TypeSymbol> hashSet2 = new HashSet<TypeSymbol>(comparer);
SubstituteConstraintTypes(constraintTypesNoUseSiteDiagnostics, typeMap1, hashSet);
SubstituteConstraintTypes(constraintTypesNoUseSiteDiagnostics2, typeMap2, hashSet2);
if (AreConstraintTypesSubset(hashSet, hashSet2, typeParameter2))
{
return AreConstraintTypesSubset(hashSet2, hashSet, typeParameter1);
}
return false;
}
public static bool HaveSameNullabilityInConstraints(TypeParameterSymbol typeParameter1, TypeMap typeMap1, TypeParameterSymbol typeParameter2, TypeMap typeMap2)
{
if (!typeParameter1.IsValueType)
{
bool? isNotNullable = typeParameter1.IsNotNullable;
bool? isNotNullable2 = typeParameter2.IsNotNullable;
if (isNotNullable.HasValue && isNotNullable2.HasValue && isNotNullable == true != (isNotNullable2 == true))
{
return false;
}
}
return HaveSameTypeConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2, SymbolEqualityComparer.AllIgnoreOptionsPlusNullableWithUnknownMatchesAny);
}
private static bool AreConstraintTypesSubset(HashSet<TypeSymbol> constraintTypes1, HashSet<TypeSymbol> constraintTypes2, TypeParameterSymbol typeParameter2)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
foreach (TypeSymbol item in constraintTypes1)
{
if ((int)item.SpecialType != 1 && !constraintTypes2.Contains(item) && ((int)item.SpecialType != 5 || !typeParameter2.HasValueTypeConstraint))
{
return false;
}
}
return true;
}
private static void SubstituteConstraintTypes(ImmutableArray<TypeWithAnnotations> types, TypeMap typeMap, HashSet<TypeSymbol> result)
{
ImmutableArray<TypeWithAnnotations>.Enumerator enumerator = types.GetEnumerator();
while (enumerator.MoveNext())
{
TypeWithAnnotations current = enumerator.Current;
result.Add(typeMap.SubstituteType(current).Type);
}
}
private static bool HaveSameParameterTypes(ImmutableArray<ParameterSymbol> params1, TypeMap typeMap1, ImmutableArray<ParameterSymbol> params2, TypeMap typeMap2, RefKindCompareMode refKindCompareMode, TypeCompareKind typeComparison)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Invalid comparison between Unknown and I4
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
int length = params1.Length;
for (int i = 0; i < length; i++)
{
ParameterSymbol parameterSymbol = params1[i];
ParameterSymbol parameterSymbol2 = params2[i];
TypeWithAnnotations typeWithAnnotations = SubstituteType(typeMap1, parameterSymbol.TypeWithAnnotations);
TypeWithAnnotations other = SubstituteType(typeMap2, parameterSymbol2.TypeWithAnnotations);
if (!typeWithAnnotations.Equals(other, typeComparison))
{
return false;
}
if ((typeComparison & 1) == 0 && !HaveSameCustomModifiers(parameterSymbol.RefCustomModifiers, typeMap1, parameterSymbol2.RefCustomModifiers, typeMap2))
{
return false;
}
RefKind refKind = parameterSymbol.RefKind;
RefKind refKind2 = parameterSymbol2.RefKind;
if ((refKindCompareMode & RefKindCompareMode.ConsiderDifferences) != RefKindCompareMode.DoNotConsiderDifferences)
{
if (!areRefKindsCompatible(refKindCompareMode, refKind, refKind2))
{
return false;
}
}
else if ((int)refKind == 0 != ((int)refKind2 == 0))
{
return false;
}
}
return true;
static bool areRefKindsCompatible(RefKindCompareMode refKindCompareMode2, RefKind val, RefKind val2)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
if (val == val2)
{
return true;
}
if ((refKindCompareMode2 & RefKindCompareMode.AllowRefReadonlyVsInMismatch) != RefKindCompareMode.DoNotConsiderDifferences)
{
if ((int)val != 3)
{
if ((int)val == 4 && (int)val2 == 3)
{
goto IL_001d;
}
}
else if ((int)val2 == 4)
{
goto IL_001d;
}
return false;
}
return false;
IL_001d:
return true;
}
}
private static TypeWithAnnotations SubstituteType(TypeMap typeMap, TypeWithAnnotations typeSymbol)
{
if (typeMap != null)
{
return typeSymbol.SubstituteType(typeMap);
}
return typeSymbol;
}
private static bool HaveSameCustomModifiers(ImmutableArray<CustomModifier> customModifiers1, TypeMap typeMap1, ImmutableArray<CustomModifier> customModifiers2, TypeMap typeMap2)
{
return SubstituteModifiers(typeMap1, customModifiers1).SequenceEqual(SubstituteModifiers(typeMap2, customModifiers2));
}
private static ImmutableArray<CustomModifier> SubstituteModifiers(TypeMap typeMap, ImmutableArray<CustomModifier> customModifiers)
{
return typeMap?.SubstituteCustomModifiers(customModifiers) ?? customModifiers;
}
private static CallingConvention GetCallingConvention(Symbol member)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Invalid comparison between Unknown and I4
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
SymbolKind kind = member.Kind;
if ((int)kind != 5)
{
if ((int)kind == 9)
{
return ((MethodSymbol)member).CallingConvention;
}
if ((int)kind != 15)
{
throw ExceptionUtilities.UnexpectedValue((object)member.Kind);
}
}
if (member.IsStatic)
{
return (CallingConvention)0;
}
return (CallingConvention)32;
}
private static bool IsVarargMethod(Symbol member)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)member.Kind == 9)
{
return ((MethodSymbol)member).IsVararg;
}
return false;
}
internal static bool ConsideringTupleNamesCreatesDifference(Symbol member1, Symbol member2)
{
if (!CSharpWithTupleNamesComparer.Equals(member1, member2))
{
return CSharpWithoutTupleNamesComparer.Equals(member1, member2);
}
return false;
}
}