blob: edeaf981a52eb281b7f923cb2523011b657b57fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Internal.TypeSystem
{
// Functionality related to deterministic ordering of types
partial class MethodSignature
{
internal int CompareTo(MethodSignature other, TypeSystemComparer comparer)
{
int result = _parameters.Length.CompareTo(other._parameters.Length);
if (result != 0)
return result;
result = ((int)_flags).CompareTo((int)other._flags);
if (result != 0)
return result;
result = _genericParameterCount.CompareTo(other._genericParameterCount);
if (result != 0)
return result;
// Most expensive checks last
result = comparer.Compare(_returnType, other._returnType);
if (result != 0)
return result;
for (int i = 0; i < _parameters.Length; i++)
{
result = comparer.Compare(_parameters[i], other._parameters[i]);
if (result != 0)
return result;
}
if (_embeddedSignatureData == null || other._embeddedSignatureData == null)
return (_embeddedSignatureData?.Length ?? 0).CompareTo(other._embeddedSignatureData?.Length ?? 0);
result = _embeddedSignatureData.Length.CompareTo(other._embeddedSignatureData.Length);
if (result != 0)
return result;
for (int i = 0; i < _embeddedSignatureData.Length; i++)
{
ref EmbeddedSignatureData thisData = ref _embeddedSignatureData[i];
ref EmbeddedSignatureData otherData = ref other._embeddedSignatureData[i];
result = string.CompareOrdinal(thisData.index, otherData.index);
if (result != 0)
return result;
result = ((int)thisData.kind).CompareTo((int)otherData.kind);
if (result != 0)
return result;
result = comparer.Compare(thisData.type, otherData.type);
if (result != 0)
return result;
}
return 0;
}
}
}
|