Browse Source

Add ILVariableEqualityComparer

pull/832/head
Siegfried Pammer 8 years ago
parent
commit
524df9d336
  1. 19
      ICSharpCode.Decompiler/IL/ILVariable.cs

19
ICSharpCode.Decompiler/IL/ILVariable.cs

@ -339,4 +339,23 @@ namespace ICSharpCode.Decompiler.IL @@ -339,4 +339,23 @@ namespace ICSharpCode.Decompiler.IL
{
int IndexInAddressInstructionList { get; set; }
}
public class ILVariableEqualityComparer : IEqualityComparer<ILVariable>
{
public static readonly ILVariableEqualityComparer Instance = new ILVariableEqualityComparer();
public bool Equals(ILVariable x, ILVariable y)
{
if (x == y)
return true;
if (x == null || y == null)
return false;
return x.Function == y.Function && x.Kind == y.Kind && x.Index == y.Index;
}
public int GetHashCode(ILVariable obj)
{
return (obj.Function, obj.Kind, obj.Index).GetHashCode();
}
}
}

Loading…
Cancel
Save