Browse Source

Make `ILVariableEqualityComparer.GetHashCode` structurally more similar to the Equals implementation

pull/3111/head
Daniel Grunwald 3 years ago
parent
commit
ea5adf8e01
  1. 4
      ICSharpCode.Decompiler/IL/ILVariable.cs

4
ICSharpCode.Decompiler/IL/ILVariable.cs

@ -654,11 +654,11 @@ namespace ICSharpCode.Decompiler.IL
{ {
if (obj.Kind is VariableKind.StackSlot or VariableKind.PatternLocal) if (obj.Kind is VariableKind.StackSlot or VariableKind.PatternLocal)
return obj.GetHashCode(); return obj.GetHashCode();
if (obj.Index == null && obj.StateMachineField == null)
return obj.GetHashCode();
if (obj.Index != null) if (obj.Index != null)
return (obj.Function, obj.Kind, obj.Index).GetHashCode(); return (obj.Function, obj.Kind, obj.Index).GetHashCode();
if (obj.StateMachineField != null)
return (obj.Function, obj.Kind, obj.StateMachineField).GetHashCode(); return (obj.Function, obj.Kind, obj.StateMachineField).GetHashCode();
return obj.GetHashCode();
} }
} }
} }

Loading…
Cancel
Save