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

50 lines
1.6 KiB
C#

using System;
namespace Microsoft.CodeAnalysis.CSharp;
internal sealed class CSDiagnostic : DiagnosticWithInfo
{
internal CSDiagnostic(DiagnosticInfo info, Location location, bool isSuppressed = false)
: base(info, location, isSuppressed)
{
}
public override string ToString()
{
return ((DiagnosticFormatter)CSharpDiagnosticFormatter.Instance).Format((Diagnostic)(object)this, (IFormatProvider)null);
}
internal override Diagnostic WithLocation(Location location)
{
if (location == (Location)null)
{
throw new ArgumentNullException("location");
}
if (location != ((Diagnostic)this).Location)
{
return (Diagnostic)(object)new CSDiagnostic(((DiagnosticWithInfo)this).Info, location, ((Diagnostic)this).IsSuppressed);
}
return (Diagnostic)(object)this;
}
internal override Diagnostic WithSeverity(DiagnosticSeverity severity)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
DiagnosticInfo instanceWithSeverity = ((DiagnosticWithInfo)this).Info.GetInstanceWithSeverity(severity);
if (instanceWithSeverity != ((DiagnosticWithInfo)this).Info)
{
return (Diagnostic)(object)new CSDiagnostic(instanceWithSeverity, ((Diagnostic)this).Location, ((Diagnostic)this).IsSuppressed);
}
return (Diagnostic)(object)this;
}
internal override Diagnostic WithIsSuppressed(bool isSuppressed)
{
if (((Diagnostic)this).IsSuppressed != isSuppressed)
{
return (Diagnostic)(object)new CSDiagnostic(((DiagnosticWithInfo)this).Info, ((Diagnostic)this).Location, isSuppressed);
}
return (Diagnostic)(object)this;
}
}