58 lines
2.1 KiB
C#
58 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Immutable;
|
|
using System.Reflection;
|
|
using System.Threading;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Symbols;
|
|
|
|
internal sealed class MissingCorLibrarySymbol : MissingAssemblySymbol
|
|
{
|
|
internal static readonly MissingCorLibrarySymbol Instance = new MissingCorLibrarySymbol();
|
|
|
|
private NamedTypeSymbol[] _lazySpecialTypes;
|
|
|
|
private TypeConversions _lazyTypeConversions;
|
|
|
|
internal override TypeConversions TypeConversions
|
|
{
|
|
get
|
|
{
|
|
if (_lazyTypeConversions == null)
|
|
{
|
|
Interlocked.CompareExchange(ref _lazyTypeConversions, new TypeConversions(this), null);
|
|
}
|
|
return _lazyTypeConversions;
|
|
}
|
|
}
|
|
|
|
private MissingCorLibrarySymbol()
|
|
: base(new AssemblyIdentity("<Missing Core Assembly>", (Version)null, (string)null, default(ImmutableArray<byte>), false, false, AssemblyContentType.Default))
|
|
{
|
|
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001e: Expected O, but got Unknown
|
|
SetCorLibrary(this);
|
|
}
|
|
|
|
internal override NamedTypeSymbol GetDeclaredSpecialType(SpecialType type)
|
|
{
|
|
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
|
|
if (_lazySpecialTypes == null)
|
|
{
|
|
Interlocked.CompareExchange(ref _lazySpecialTypes, new NamedTypeSymbol[47], null);
|
|
}
|
|
if ((object)_lazySpecialTypes[type] == null)
|
|
{
|
|
MetadataTypeName fullName = MetadataTypeName.FromFullName(SpecialTypes.GetMetadataName(type), true, -1);
|
|
NamedTypeSymbol value = new MissingMetadataTypeSymbol.TopLevel(moduleSymbol, ref fullName, type);
|
|
Interlocked.CompareExchange(ref _lazySpecialTypes[type], value, null);
|
|
}
|
|
return _lazySpecialTypes[type];
|
|
}
|
|
}
|