blob: 09ea200aa065a46afaf9f453bb2ba76ded336415 (
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
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Reflection.Metadata.Ecma335;
namespace Internal.TypeSystem.Ecma
{
// Functionality related to deterministic ordering of types
partial class EcmaMethod
{
protected internal override int ClassCode => 1419431046;
protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (EcmaMethod)other;
EcmaModule module = _type.EcmaModule;
EcmaModule otherModule = otherMethod._type.EcmaModule;
// Sort by module in preference to by token. This will place methods of the same type near each other
// even when working with several modules
int result = module.CompareTo(otherModule);
if (result != 0)
return result;
return module.MetadataReader.GetToken(_handle) - otherModule.MetadataReader.GetToken(otherMethod._handle);
}
}
}
|