34 lines
923 B
C#
34 lines
923 B
C#
using System.Threading;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
internal abstract class LazyDiagnosticInfo : DiagnosticInfo
|
|
{
|
|
private DiagnosticInfo? _lazyInfo;
|
|
|
|
protected LazyDiagnosticInfo()
|
|
: base((CommonMessageProvider)(object)MessageProvider.Instance, -1)
|
|
{
|
|
}
|
|
|
|
internal sealed override DiagnosticInfo GetResolvedInfo()
|
|
{
|
|
if (_lazyInfo == null)
|
|
{
|
|
Interlocked.CompareExchange(ref _lazyInfo, ResolveInfo() ?? CSDiagnosticInfo.VoidDiagnosticInfo, null);
|
|
}
|
|
return _lazyInfo;
|
|
}
|
|
|
|
protected LazyDiagnosticInfo(LazyDiagnosticInfo original, DiagnosticSeverity severity)
|
|
: base((DiagnosticInfo)(object)original, severity)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
_lazyInfo = original._lazyInfo;
|
|
}
|
|
|
|
protected abstract override DiagnosticInfo GetInstanceWithSeverityCore(DiagnosticSeverity severity);
|
|
|
|
protected abstract DiagnosticInfo? ResolveInfo();
|
|
}
|