ModernUO/Projects/SerializationGenerator/SerializableMigration/SerializableFieldFlagComparer.cs
Kamron Batman 2c8097f707
fix(codegen): Fixes various code gen issues. Adds better embedded serialization support (#688)
* Adds save flag support (see `ElvenGlasses` for an example)
* Updates AOSAttributes so they are code genned
* Fixes embedded object support by adding an `IRawSerializable`
* Fixes various inconsistencies in serializing with codegen
2021-08-17 02:43:52 -07:00

31 lines
762 B
C#

using System.Collections.Generic;
using Microsoft.CodeAnalysis;
namespace SerializableMigration
{
public class SerializableFieldFlagComparer : IComparer<(IMethodSymbol, int)>
{
public int Compare((IMethodSymbol, int) x, (IMethodSymbol, int) y)
{
var (methodSymbolX, orderX) = x;
var (methodSymbolY, orderY) = y;
if (ReferenceEquals(methodSymbolX, methodSymbolY))
{
return 0;
}
if (ReferenceEquals(null, methodSymbolY))
{
return 1;
}
if (ReferenceEquals(null, methodSymbolX))
{
return -1;
}
return orderX.CompareTo(orderY);
}
}
}