Files
2026-08-27 10:56:38 -06:00

42 lines
889 B
C#

using System;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeGen;
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
internal readonly struct ClosureDebugInfo(int syntaxOffset, DebugId closureId) : IEquatable<ClosureDebugInfo>
{
public readonly int SyntaxOffset = syntaxOffset;
public readonly DebugId ClosureId = closureId;
public bool Equals(ClosureDebugInfo other)
{
if (SyntaxOffset == other.SyntaxOffset)
{
return ClosureId.Equals(other.ClosureId);
}
return false;
}
public override bool Equals(object? obj)
{
if (obj is ClosureDebugInfo)
{
return Equals((ClosureDebugInfo)obj);
}
return false;
}
public override int GetHashCode()
{
return Hash.Combine(SyntaxOffset, ClosureId.GetHashCode());
}
internal string GetDebuggerDisplay()
{
return $"({ClosureId.GetDebuggerDisplay()} @{SyntaxOffset})";
}
}