37 lines
982 B
C#
37 lines
982 B
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal class LexicalOrderSymbolComparer : IComparer<Symbol>
|
|
{
|
|
public static readonly LexicalOrderSymbolComparer Instance = new LexicalOrderSymbolComparer();
|
|
|
|
private LexicalOrderSymbolComparer()
|
|
{
|
|
}
|
|
|
|
public int Compare(Symbol x, Symbol y)
|
|
{
|
|
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
|
|
if (x == y)
|
|
{
|
|
return 0;
|
|
}
|
|
LexicalSortKey lexicalSortKey = x.GetLexicalSortKey();
|
|
LexicalSortKey lexicalSortKey2 = y.GetLexicalSortKey();
|
|
int num = LexicalSortKey.Compare(lexicalSortKey, lexicalSortKey2);
|
|
if (num != 0)
|
|
{
|
|
return num;
|
|
}
|
|
num = SymbolKindExtensions.ToSortOrder(x.Kind) - SymbolKindExtensions.ToSortOrder(y.Kind);
|
|
if (num != 0)
|
|
{
|
|
return num;
|
|
}
|
|
return string.CompareOrdinal(x.Name, y.Name);
|
|
}
|
|
}
|