Welcome to mirror list, hosted at ThFree Co, Russian Federation.

EcmaField.Sorting.cs « Ecma « TypeSystem « Common « tools « coreclr « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9151b571936b7a6008af24828520a9dfddc6ea38 (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
// 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 and members
    partial class EcmaField
    {
        protected internal override int ClassCode => 44626835;

        protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
        {
            var otherField = (EcmaField)other;

            EcmaModule module = _type.EcmaModule;
            EcmaModule otherModule = otherField._type.EcmaModule;

            int result = module.MetadataReader.GetToken(_handle) - otherModule.MetadataReader.GetToken(otherField._handle);
            if (result != 0)
                return result;

            return module.CompareTo(otherModule);
        }
    }
}