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

105 lines
2.4 KiB
C#

using System;
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
internal readonly struct NamespaceExtent : IEquatable<NamespaceExtent>
{
private readonly NamespaceKind _kind;
private readonly object _symbolOrCompilation;
public NamespaceKind Kind => _kind;
public ModuleSymbol Module
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)_kind == 1)
{
return (ModuleSymbol)_symbolOrCompilation;
}
throw new InvalidOperationException();
}
}
public AssemblySymbol Assembly
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)_kind == 2)
{
return (AssemblySymbol)_symbolOrCompilation;
}
throw new InvalidOperationException();
}
}
public CSharpCompilation Compilation
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)_kind == 3)
{
return (CSharpCompilation)_symbolOrCompilation;
}
throw new InvalidOperationException();
}
}
public override string ToString()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return $"{_kind}: {_symbolOrCompilation}";
}
internal NamespaceExtent(ModuleSymbol module)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_kind = (NamespaceKind)1;
_symbolOrCompilation = module;
}
internal NamespaceExtent(AssemblySymbol assembly)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_kind = (NamespaceKind)2;
_symbolOrCompilation = assembly;
}
internal NamespaceExtent(CSharpCompilation compilation)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_kind = (NamespaceKind)3;
_symbolOrCompilation = compilation;
}
public override bool Equals(object obj)
{
if (obj is NamespaceExtent)
{
return Equals((NamespaceExtent)obj);
}
return false;
}
public bool Equals(NamespaceExtent other)
{
return object.Equals(_symbolOrCompilation, other._symbolOrCompilation);
}
public override int GetHashCode()
{
if (_symbolOrCompilation != null)
{
return _symbolOrCompilation.GetHashCode();
}
return 0;
}
}