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

5857 lines
288 KiB
C#

using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Threading;
using Microsoft.Cci;
using Microsoft.CodeAnalysis.CSharp.Emit;
using Microsoft.CodeAnalysis.CSharp.Emit.NoPia;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE;
using Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel;
using Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.RuntimeMembers;
using Microsoft.CodeAnalysis.Symbols;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp;
public sealed class CSharpCompilation : Compilation
{
internal class EntryPoint
{
public readonly Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol? MethodSymbol;
public readonly ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> Diagnostics;
public static readonly EntryPoint None = new EntryPoint(null, ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Empty);
public EntryPoint(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol? methodSymbol, ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> diagnostics)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
MethodSymbol = methodSymbol;
Diagnostics = diagnostics;
}
}
private readonly struct ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span) : IEquatable<ImportInfo>
{
public readonly SyntaxTree Tree = tree;
public readonly SyntaxKind Kind = kind;
public readonly TextSpan Span = span;
public override bool Equals(object? obj)
{
if (obj is ImportInfo)
{
return Equals((ImportInfo)obj);
}
return false;
}
public bool Equals(ImportInfo other)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (other.Kind == Kind && other.Tree == Tree)
{
return other.Span == Span;
}
return false;
}
public override int GetHashCode()
{
return Hash.Combine<SyntaxTree>(Tree, ((TextSpan)(ref Span)).Start);
}
}
private class DuplicateFilePathsVisitor : CSharpSymbolVisitor
{
private readonly PooledHashSet<string> _duplicatePaths = PooledHashSet<string>.GetInstance();
private readonly DiagnosticBag _diagnostics;
private bool _hasDuplicateFilePaths;
public DuplicateFilePathsVisitor(DiagnosticBag diagnostics)
{
_diagnostics = diagnostics;
}
public bool CheckDuplicateFilePathsAndFree(ImmutableArray<SyntaxTree> syntaxTrees, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol globalNamespace)
{
PooledHashSet<string> instance = PooledHashSet<string>.GetInstance();
ImmutableArray<SyntaxTree>.Enumerator enumerator = syntaxTrees.GetEnumerator();
while (enumerator.MoveNext())
{
SyntaxTree current = enumerator.Current;
if (!((HashSet<string>)(object)instance).Add(current.FilePath))
{
((HashSet<string>)(object)_duplicatePaths).Add(current.FilePath);
}
}
instance.Free();
if (((IEnumerable<string>)_duplicatePaths).Any())
{
VisitNamespace(globalNamespace);
}
_duplicatePaths.Free();
return _hasDuplicateFilePaths;
}
public override void VisitNamespace(Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol symbol)
{
ImmutableArray<Symbol>.Enumerator enumerator = symbol.GetMembers().GetEnumerator();
while (enumerator.MoveNext())
{
Symbol current = enumerator.Current;
if (!(current is Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol symbol2))
{
if (current is Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol symbol3)
{
VisitNamedType(symbol3);
}
}
else
{
VisitNamespace(symbol2);
}
}
}
public override void VisitNamedType(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol symbol)
{
if (symbol.IsFileLocal)
{
Location firstLocation = symbol.GetFirstLocation();
SyntaxTree sourceTree = firstLocation.SourceTree;
string text = ((sourceTree != null) ? sourceTree.FilePath : null);
if (((HashSet<string>)(object)_duplicatePaths).Contains(text))
{
_diagnostics.Add(ErrorCode.ERR_FileTypeNonUniquePath, firstLocation, symbol, text);
_hasDuplicateFilePaths = true;
}
}
}
}
private abstract class AbstractSymbolSearcher
{
private readonly PooledDictionary<Declaration, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol> _cache;
private readonly CSharpCompilation _compilation;
private readonly bool _includeNamespace;
private readonly bool _includeType;
private readonly bool _includeMember;
private readonly CancellationToken _cancellationToken;
protected AbstractSymbolSearcher(CSharpCompilation compilation, SymbolFilter filter, CancellationToken cancellationToken)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Invalid comparison between Unknown and I4
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_0031: 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_0035: Invalid comparison between Unknown and I4
_cache = PooledDictionary<Declaration, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>.GetInstance();
_compilation = compilation;
_includeNamespace = (filter & 1) == 1;
_includeType = (filter & 2) == 2;
_includeMember = (filter & 4) == 4;
_cancellationToken = cancellationToken;
}
protected abstract bool Matches(string name);
protected abstract bool ShouldCheckTypeForMembers(MergedTypeDeclaration current);
public IEnumerable<Symbol> GetSymbolsWithName()
{
HashSet<Symbol> hashSet = new HashSet<Symbol>();
ArrayBuilder<MergedNamespaceOrTypeDeclaration> instance = ArrayBuilder<MergedNamespaceOrTypeDeclaration>.GetInstance();
AppendSymbolsWithName(instance, _compilation.MergedRootDeclaration, hashSet);
instance.Free();
_cache.Free();
return hashSet;
}
private void AppendSymbolsWithName(ArrayBuilder<MergedNamespaceOrTypeDeclaration> spine, MergedNamespaceOrTypeDeclaration current, HashSet<Symbol> set)
{
if (current.Kind == DeclarationKind.Namespace)
{
if (_includeNamespace && Matches(current.Name))
{
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol spineSymbol = GetSpineSymbol(spine);
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol symbol = GetSymbol(spineSymbol, current);
if (symbol != null)
{
set.Add(symbol);
}
}
}
else
{
if (_includeType && Matches(current.Name))
{
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol spineSymbol2 = GetSpineSymbol(spine);
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol symbol2 = GetSymbol(spineSymbol2, current);
if (symbol2 != null)
{
set.Add(symbol2);
}
}
if (_includeMember)
{
MergedTypeDeclaration current2 = (MergedTypeDeclaration)current;
if (ShouldCheckTypeForMembers(current2))
{
AppendMemberSymbolsWithName(spine, current2, set);
}
}
}
spine.Add(current);
ImmutableArray<Declaration>.Enumerator enumerator = current.Children.GetEnumerator();
while (enumerator.MoveNext())
{
Declaration current3 = enumerator.Current;
if (current3 is MergedNamespaceOrTypeDeclaration current4 && (_includeMember || _includeType || current3.Kind == DeclarationKind.Namespace))
{
AppendSymbolsWithName(spine, current4, set);
}
}
spine.RemoveAt(spine.Count - 1);
}
private void AppendMemberSymbolsWithName(ArrayBuilder<MergedNamespaceOrTypeDeclaration> spine, MergedTypeDeclaration current, HashSet<Symbol> set)
{
CancellationToken cancellationToken = _cancellationToken;
cancellationToken.ThrowIfCancellationRequested();
spine.Add((MergedNamespaceOrTypeDeclaration)current);
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol spineSymbol = GetSpineSymbol(spine);
if (spineSymbol != null)
{
ImmutableArray<Symbol>.Enumerator enumerator = spineSymbol.GetMembers().GetEnumerator();
while (enumerator.MoveNext())
{
Symbol current2 = enumerator.Current;
if (!current2.IsTypeOrTypeAlias() && (current2.CanBeReferencedByName || current2.IsExplicitInterfaceImplementation() || current2.IsIndexer()) && Matches(current2.Name))
{
set.Add(current2);
}
}
}
spine.RemoveAt(spine.Count - 1);
}
protected Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol? GetSpineSymbol(ArrayBuilder<MergedNamespaceOrTypeDeclaration> spine)
{
if (spine.Count == 0)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol cachedSymbol = GetCachedSymbol(spine[spine.Count - 1]);
if (cachedSymbol != null)
{
return cachedSymbol;
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol namespaceOrTypeSymbol = _compilation.GlobalNamespace;
for (int i = 1; i < spine.Count; i++)
{
namespaceOrTypeSymbol = GetSymbol(namespaceOrTypeSymbol, spine[i]);
}
return namespaceOrTypeSymbol;
}
private Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol? GetCachedSymbol(MergedNamespaceOrTypeDeclaration declaration)
{
if (!((Dictionary<Declaration, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>)(object)_cache).TryGetValue((Declaration)declaration, out Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol value))
{
return null;
}
return value;
}
private Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol? GetSymbol(Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol? container, MergedNamespaceOrTypeDeclaration declaration)
{
if (container == null)
{
return _compilation.GlobalNamespace;
}
if (declaration.Kind == DeclarationKind.Namespace)
{
AddCache(container.GetMembers(declaration.Name).OfType<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>());
}
else
{
AddCache(container.GetTypeMembers(declaration.Name));
}
return GetCachedSymbol(declaration);
}
private void AddCache(IEnumerable<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol> symbols)
{
foreach (Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol symbol in symbols)
{
MergedNamespaceSymbol mergedNamespaceSymbol = symbol as MergedNamespaceSymbol;
if (mergedNamespaceSymbol != null)
{
((Dictionary<Declaration, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>)(object)_cache)[(Declaration)mergedNamespaceSymbol.ConstituentNamespaces.OfType<SourceNamespaceSymbol>().First().MergedDeclaration] = symbol;
continue;
}
SourceNamespaceSymbol sourceNamespaceSymbol = symbol as SourceNamespaceSymbol;
if (sourceNamespaceSymbol != null)
{
((Dictionary<Declaration, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>)(object)_cache)[(Declaration)sourceNamespaceSymbol.MergedDeclaration] = sourceNamespaceSymbol;
}
else if (symbol is SourceMemberContainerTypeSymbol sourceMemberContainerTypeSymbol)
{
((Dictionary<Declaration, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>)(object)_cache)[(Declaration)sourceMemberContainerTypeSymbol.MergedDeclaration] = sourceMemberContainerTypeSymbol;
}
}
}
}
private class PredicateSymbolSearcher : AbstractSymbolSearcher
{
private readonly Func<string, bool> _predicate;
public PredicateSymbolSearcher(CSharpCompilation compilation, SymbolFilter filter, Func<string, bool> predicate, CancellationToken cancellationToken)
: base(compilation, filter, cancellationToken)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_predicate = predicate;
}
protected override bool ShouldCheckTypeForMembers(MergedTypeDeclaration current)
{
return true;
}
protected override bool Matches(string name)
{
return _predicate(name);
}
}
private class NameSymbolSearcher : AbstractSymbolSearcher
{
private readonly string _name;
public NameSymbolSearcher(CSharpCompilation compilation, SymbolFilter filter, string name, CancellationToken cancellationToken)
: base(compilation, filter, cancellationToken)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_name = name;
}
protected override bool ShouldCheckTypeForMembers(MergedTypeDeclaration current)
{
ImmutableArray<SingleTypeDeclaration>.Enumerator enumerator = current.Declarations.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Current.MemberNames.Value.Contains(_name))
{
return true;
}
}
return false;
}
protected override bool Matches(string name)
{
return _name == name;
}
}
private class UsingsFromOptionsAndDiagnostics
{
public static readonly UsingsFromOptionsAndDiagnostics Empty = new UsingsFromOptionsAndDiagnostics
{
UsingNamespacesOrTypes = ImmutableArray<NamespaceOrTypeAndUsingDirective>.Empty,
Diagnostics = null
};
private SymbolCompletionState _state;
public ImmutableArray<NamespaceOrTypeAndUsingDirective> UsingNamespacesOrTypes { get; init; }
public DiagnosticBag? Diagnostics { get; init; }
public static UsingsFromOptionsAndDiagnostics FromOptions(CSharpCompilation compilation)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
ImmutableArray<string> usings = compilation.Options.Usings;
if (usings.Length == 0)
{
return Empty;
}
DiagnosticBag val = new DiagnosticBag();
InContainerBinder inContainerBinder = new InContainerBinder(compilation.GlobalNamespace, new BuckStopsHereBinder(compilation, null));
ArrayBuilder<NamespaceOrTypeAndUsingDirective> instance = ArrayBuilder<NamespaceOrTypeAndUsingDirective>.GetInstance();
PooledHashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol> instance2 = PooledHashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>.GetInstance();
ImmutableArray<string>.Enumerator enumerator = usings.GetEnumerator();
while (enumerator.MoveNext())
{
string current = enumerator.Current;
if (StringExtensions.IsValidClrNamespaceName(current))
{
string[] array = current.Split(new char[1] { '.' });
NameSyntax nameSyntax = SyntaxFactory.IdentifierName(array[0]);
for (int i = 1; i < array.Length; i++)
{
nameSyntax = SyntaxFactory.QualifiedName(nameSyntax, SyntaxFactory.IdentifierName(array[i]));
}
BindingDiagnosticBag instance3 = BindingDiagnosticBag.GetInstance();
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol namespaceOrTypeSymbol = inContainerBinder.BindNamespaceOrTypeSymbol(nameSyntax, instance3).NamespaceOrTypeSymbol;
if (((HashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>)(object)instance2).Add(namespaceOrTypeSymbol))
{
instance.Add(new NamespaceOrTypeAndUsingDirective(namespaceOrTypeSymbol, null, ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance3).DependenciesBag.ToImmutableArray()));
}
val.AddRange(((BindingDiagnosticBag)instance3).DiagnosticBag);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance3).Free();
}
}
if (val.IsEmptyWithoutResolution)
{
val = null;
}
instance2.Free();
if (instance.Count == 0 && val == null)
{
instance.Free();
return Empty;
}
return new UsingsFromOptionsAndDiagnostics
{
UsingNamespacesOrTypes = instance.ToImmutableAndFree(),
Diagnostics = val
};
}
internal void Complete(CSharpCompilation compilation, CancellationToken cancellationToken)
{
while (true)
{
cancellationToken.ThrowIfCancellationRequested();
CompletionPart nextIncompletePart = _state.NextIncompletePart;
switch (nextIncompletePart)
{
case CompletionPart.StartBaseType:
if (_state.NotePartComplete(CompletionPart.StartBaseType))
{
Validate(compilation);
_state.NotePartComplete(CompletionPart.FinishBaseType);
}
break;
case CompletionPart.FinishBaseType:
_state.SpinWaitComplete(CompletionPart.FinishBaseType, cancellationToken);
break;
case CompletionPart.None:
return;
default:
_state.NotePartComplete(CompletionPart.MethodSymbolAll | CompletionPart.StartInterfaces | CompletionPart.FinishInterfaces | CompletionPart.EnumUnderlyingType | CompletionPart.TypeArguments | CompletionPart.FinishMemberChecks | CompletionPart.MembersCompletedChecksStarted | CompletionPart.MembersCompleted);
break;
}
_state.SpinWaitComplete(nextIncompletePart, cancellationToken);
}
}
private void Validate(CSharpCompilation compilation)
{
if (this == Empty)
{
return;
}
DiagnosticBag declarationDiagnostics = compilation.DeclarationDiagnostics;
BindingDiagnosticBag diagnostics = BindingDiagnosticBag.GetInstance();
TypeConversions typeConversions = compilation.SourceAssembly.CorLibrary.TypeConversions;
ImmutableArray<NamespaceOrTypeAndUsingDirective>.Enumerator enumerator = UsingNamespacesOrTypes.GetEnumerator();
while (enumerator.MoveNext())
{
NamespaceOrTypeAndUsingDirective current = enumerator.Current;
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).Clear();
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).AddDependencies(current.Dependencies);
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol namespaceOrType = current.NamespaceOrType;
if (namespaceOrType.IsType)
{
((Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol)namespaceOrType).CheckAllConstraints(location: NoLocation.Singleton, compilation: compilation, conversions: typeConversions, diagnostics: diagnostics);
}
declarationDiagnostics.AddRange(((BindingDiagnosticBag)diagnostics).DiagnosticBag);
recordImportDependencies(namespaceOrType);
}
if (Diagnostics != null && !Diagnostics.IsEmptyWithoutResolution)
{
declarationDiagnostics.AddRange(Diagnostics.AsEnumerable());
}
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).Free();
void recordImportDependencies(Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol target)
{
if (target.IsNamespace)
{
diagnostics.AddAssembliesUsedByNamespaceReference((Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol)target);
}
compilation.AddUsedAssemblies(((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).DependenciesBag);
}
}
}
internal static class TupleNamesEncoder
{
public static ImmutableArray<string?> Encode(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
ArrayBuilder<string> instance = ArrayBuilder<string>.GetInstance();
if (!TryGetNames(type, instance))
{
instance.Free();
return default(ImmutableArray<string>);
}
return instance.ToImmutableAndFree();
}
public static ImmutableArray<TypedConstant> Encode(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol stringType)
{
ArrayBuilder<string> instance = ArrayBuilder<string>.GetInstance();
if (!TryGetNames(type, instance))
{
instance.Free();
return default(ImmutableArray<TypedConstant>);
}
ImmutableArray<TypedConstant> result = ArrayBuilderExtensions.SelectAsArray<string, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, TypedConstant>(instance, (Func<string, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, TypedConstant>)((string name, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol constantType) => new TypedConstant((ITypeSymbolInternal)(object)constantType, (TypedConstantKind)1, (object)name)), stringType);
instance.Free();
return result;
}
internal static bool TryGetNames(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, ArrayBuilder<string?> namesBuilder)
{
type.VisitType((Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol t, ArrayBuilder<string> builder, bool _ignore) => AddNames(t, builder), namesBuilder);
return ArrayBuilderExtensions.Any<string>(namesBuilder, (Func<string, bool>)((string name) => name != null));
}
private static bool AddNames(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, ArrayBuilder<string?> namesBuilder)
{
if (type.IsTupleType)
{
if (type.TupleElementNames.IsDefaultOrEmpty)
{
namesBuilder.AddMany((string)null, type.TupleElementTypesWithAnnotations.Length);
}
else
{
namesBuilder.AddRange(type.TupleElementNames);
}
}
return false;
}
}
internal static class DynamicTransformsEncoder
{
internal static ImmutableArray<TypedConstant> Encode(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, RefKind refKind, int customModifiersCount, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol booleanType)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
ArrayBuilder<bool> instance = ArrayBuilder<bool>.GetInstance();
Encode(type, customModifiersCount, refKind, instance, addCustomModifierFlags: true);
ImmutableArray<TypedConstant> result = ArrayBuilderExtensions.SelectAsArray<bool, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, TypedConstant>(instance, (Func<bool, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, TypedConstant>)((bool flag, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol constantType) => new TypedConstant((ITypeSymbolInternal)(object)constantType, (TypedConstantKind)1, (object)flag)), booleanType);
instance.Free();
return result;
}
internal static ImmutableArray<bool> Encode(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, RefKind refKind, int customModifiersCount)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
ArrayBuilder<bool> instance = ArrayBuilder<bool>.GetInstance();
Encode(type, customModifiersCount, refKind, instance, addCustomModifierFlags: true);
return instance.ToImmutableAndFree();
}
internal static ImmutableArray<bool> EncodeWithoutCustomModifierFlags(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, RefKind refKind)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
ArrayBuilder<bool> instance = ArrayBuilder<bool>.GetInstance();
Encode(type, -1, refKind, instance, addCustomModifierFlags: false);
return instance.ToImmutableAndFree();
}
internal static void Encode(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int customModifiersCount, RefKind refKind, ArrayBuilder<bool> transformFlagsBuilder, bool addCustomModifierFlags)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if ((int)refKind != 0)
{
transformFlagsBuilder.Add(false);
}
if (addCustomModifierFlags)
{
HandleCustomModifiers(customModifiersCount, transformFlagsBuilder);
type.VisitType((Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol typeSymbol, ArrayBuilder<bool> builder, bool isNested) => AddFlags(typeSymbol, builder, isNested, addCustomModifierFlags: true), transformFlagsBuilder);
}
else
{
type.VisitType((Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol typeSymbol, ArrayBuilder<bool> builder, bool isNested) => AddFlags(typeSymbol, builder, isNested, addCustomModifierFlags: false), transformFlagsBuilder);
}
}
private static bool AddFlags(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, ArrayBuilder<bool> transformFlagsBuilder, bool isNestedNamedType, bool addCustomModifierFlags)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
TypeKind typeKind = type.TypeKind;
if ((int)typeKind <= 4)
{
if ((int)typeKind != 1)
{
if ((int)typeKind != 4)
{
goto IL_0093;
}
transformFlagsBuilder.Add(true);
}
else
{
if (addCustomModifierFlags)
{
HandleCustomModifiers(((Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol)type).ElementTypeWithAnnotations.CustomModifiers.Length, transformFlagsBuilder);
}
transformFlagsBuilder.Add(false);
}
}
else
{
if ((int)typeKind != 9)
{
if ((int)typeKind != 13)
{
goto IL_0093;
}
handleFunctionPointerType((Microsoft.CodeAnalysis.CSharp.Symbols.FunctionPointerTypeSymbol)type, transformFlagsBuilder, addCustomModifierFlags);
return true;
}
if (addCustomModifierFlags)
{
HandleCustomModifiers(((Microsoft.CodeAnalysis.CSharp.Symbols.PointerTypeSymbol)type).PointedAtTypeWithAnnotations.CustomModifiers.Length, transformFlagsBuilder);
}
transformFlagsBuilder.Add(false);
}
goto IL_009d;
IL_0093:
if (!isNestedNamedType)
{
transformFlagsBuilder.Add(false);
}
goto IL_009d;
IL_009d:
return false;
static void handleFunctionPointerType(Microsoft.CodeAnalysis.CSharp.Symbols.FunctionPointerTypeSymbol funcPtr, ArrayBuilder<bool> val, bool flag)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
Func<Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, (ArrayBuilder<bool>, bool), bool, bool> visitor = (Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type2, (ArrayBuilder<bool> builder, bool addCustomModifierFlags) param, bool isNestedNamedType2) => AddFlags(type2, param.builder, isNestedNamedType2, param.addCustomModifierFlags);
val.Add(false);
FunctionPointerMethodSymbol signature = funcPtr.Signature;
handle(signature.RefKind, signature.RefCustomModifiers, signature.ReturnTypeWithAnnotations);
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol>.Enumerator enumerator = signature.Parameters.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol current = enumerator.Current;
handle(current.RefKind, current.RefCustomModifiers, current.TypeWithAnnotations);
}
void handle(RefKind refKind, ImmutableArray<CustomModifier> customModifiers, TypeWithAnnotations twa)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (flag)
{
HandleCustomModifiers(customModifiers.Length, val);
}
if ((int)refKind != 0)
{
val.Add(false);
}
if (flag)
{
HandleCustomModifiers(twa.CustomModifiers.Length, val);
}
twa.Type.VisitType(visitor, (val, flag));
}
}
}
private static void HandleCustomModifiers(int customModifiersCount, ArrayBuilder<bool> transformFlagsBuilder)
{
transformFlagsBuilder.AddMany(false, customModifiersCount);
}
}
internal static class NativeIntegerTransformsEncoder
{
internal static void Encode(ArrayBuilder<bool> builder, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
type.VisitType((Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol typeSymbol, ArrayBuilder<bool> builder2, bool isNested) => AddFlags(typeSymbol, builder2), builder);
}
private static bool AddFlags(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, ArrayBuilder<bool> builder)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
SpecialType specialType = type.SpecialType;
if (specialType - 21 <= 1)
{
builder.Add(type.IsNativeIntegerWrapperType);
}
return false;
}
}
internal class SpecialMembersSignatureComparer : SignatureComparer<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol>
{
public static readonly SpecialMembersSignatureComparer Instance = new SpecialMembersSignatureComparer();
protected SpecialMembersSignatureComparer()
{
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol? GetMDArrayElementType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)type.Kind != 1)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol arrayTypeSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol)type;
if (arrayTypeSymbol.IsSZArray)
{
return null;
}
return arrayTypeSymbol.ElementType;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol GetFieldType(Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol field)
{
return field.Type;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol GetPropertyType(Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol property)
{
return property.Type;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol? GetGenericTypeArgument(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int argumentIndex)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)type.Kind != 11)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol)type;
if (namedTypeSymbol.Arity <= argumentIndex)
{
return null;
}
if ((object)namedTypeSymbol.ContainingType != null)
{
return null;
}
return namedTypeSymbol.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[argumentIndex].Type;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol? GetGenericTypeDefinition(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)type.Kind != 11)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol)type;
if ((object)namedTypeSymbol.ContainingType != null)
{
return null;
}
if (namedTypeSymbol.Arity == 0)
{
return null;
}
return namedTypeSymbol.OriginalDefinition;
}
protected override ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol> GetParameters(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method)
{
return method.Parameters;
}
protected override ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol> GetParameters(Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol property)
{
return property.Parameters;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol GetParamType(Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol parameter)
{
return parameter.Type;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol? GetPointedToType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)type.Kind != 14)
{
return null;
}
return ((Microsoft.CodeAnalysis.CSharp.Symbols.PointerTypeSymbol)type).PointedAtType;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol GetReturnType(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method)
{
return method.ReturnType;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol? GetSZArrayElementType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)type.Kind != 1)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol arrayTypeSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol)type;
if (!arrayTypeSymbol.IsSZArray)
{
return null;
}
return arrayTypeSymbol.ElementType;
}
protected override bool IsByRefParam(Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol parameter)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
return (int)parameter.RefKind > 0;
}
protected override bool IsByRefMethod(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
return (int)method.RefKind > 0;
}
protected override bool IsByRefProperty(Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol property)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
return (int)property.RefKind > 0;
}
protected override bool IsGenericMethodTypeParam(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int paramPosition)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
if ((int)type.Kind != 17)
{
return false;
}
Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol typeParameterSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol)type;
if ((int)typeParameterSymbol.ContainingSymbol.Kind != 9)
{
return false;
}
return typeParameterSymbol.Ordinal == paramPosition;
}
protected override bool IsGenericTypeParam(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int paramPosition)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
if ((int)type.Kind != 17)
{
return false;
}
Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol typeParameterSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol)type;
if ((int)typeParameterSymbol.ContainingSymbol.Kind != 11)
{
return false;
}
return typeParameterSymbol.Ordinal == paramPosition;
}
protected override bool MatchArrayRank(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int countOfDimensions)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)type.Kind != 1)
{
return false;
}
return ((Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol)type).Rank == countOfDimensions;
}
protected override bool MatchTypeToTypeId(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int typeId)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
if ((int)type.OriginalDefinition.SpecialType == typeId)
{
if (type.IsDefinition)
{
return true;
}
return type.Equals(type.OriginalDefinition, (TypeCompareKind)8);
}
return false;
}
}
internal sealed class WellKnownMembersSignatureComparer : SpecialMembersSignatureComparer
{
private readonly CSharpCompilation _compilation;
public WellKnownMembersSignatureComparer(CSharpCompilation compilation)
{
_compilation = compilation;
}
protected override bool MatchTypeToTypeId(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int typeId)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
WellKnownType val = (WellKnownType)typeId;
if (WellKnownTypes.IsWellKnownType(val))
{
return type.Equals(_compilation.GetWellKnownType(val), (TypeCompareKind)8);
}
return base.MatchTypeToTypeId(type, typeId);
}
}
internal sealed class ReferenceManager : CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>
{
private abstract class AssemblyDataForMetadataOrCompilation : AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>
{
private ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> _assemblies;
private readonly AssemblyIdentity _identity;
private readonly ImmutableArray<AssemblyIdentity> _referencedAssemblies;
private readonly bool _embedInteropTypes;
public override AssemblyIdentity Identity => _identity;
public override ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> AvailableSymbols
{
get
{
if (_assemblies.IsDefault)
{
ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> instance = ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.GetInstance();
AddAvailableSymbols(instance);
_assemblies = instance.ToImmutableAndFree();
}
return _assemblies;
}
}
public override ImmutableArray<AssemblyIdentity> AssemblyReferences => _referencedAssemblies;
public sealed override bool IsLinked => _embedInteropTypes;
protected AssemblyDataForMetadataOrCompilation(AssemblyIdentity identity, ImmutableArray<AssemblyIdentity> referencedAssemblies, bool embedInteropTypes)
{
_embedInteropTypes = embedInteropTypes;
_identity = identity;
_referencedAssemblies = referencedAssemblies;
}
internal abstract Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol CreateAssemblySymbol();
protected abstract void AddAvailableSymbols(ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> builder);
public override AssemblyReferenceBinding<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] BindAssemblyReferences(MultiDictionary<string, (AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> DefinitionData, int DefinitionIndex)> assemblies, AssemblyIdentityComparer assemblyIdentityComparer)
{
return CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.ResolveReferencedAssemblies(_referencedAssemblies, assemblies, true, assemblyIdentityComparer);
}
}
private sealed class AssemblyDataForFile : AssemblyDataForMetadataOrCompilation
{
public readonly PEAssembly Assembly;
public readonly WeakList<IAssemblySymbolInternal> CachedSymbols;
public readonly DocumentationProvider DocumentationProvider;
private readonly MetadataImportOptions _compilationImportOptions;
private readonly string _sourceAssemblySimpleName;
private bool _internalsVisibleComputed;
private bool _internalsPotentiallyVisibleToCompilation;
internal bool InternalsMayBeVisibleToCompilation
{
get
{
if (!_internalsVisibleComputed)
{
_internalsPotentiallyVisibleToCompilation = CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.InternalsMayBeVisibleToAssemblyBeingCompiled(_sourceAssemblySimpleName, Assembly);
_internalsVisibleComputed = true;
}
return _internalsPotentiallyVisibleToCompilation;
}
}
internal MetadataImportOptions EffectiveImportOptions
{
get
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
if (InternalsMayBeVisibleToCompilation && (int)_compilationImportOptions == 0)
{
return (MetadataImportOptions)1;
}
return _compilationImportOptions;
}
}
public override bool ContainsNoPiaLocalTypes => Assembly.ContainsNoPiaLocalTypes();
public override bool DeclaresTheObjectClass => Assembly.DeclaresTheObjectClass;
public override Compilation? SourceCompilation => null;
public AssemblyDataForFile(PEAssembly assembly, WeakList<IAssemblySymbolInternal> cachedSymbols, bool embedInteropTypes, DocumentationProvider documentationProvider, string sourceAssemblySimpleName, MetadataImportOptions compilationImportOptions)
: base(assembly.Identity, assembly.AssemblyReferences, embedInteropTypes)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
CachedSymbols = cachedSymbols;
Assembly = assembly;
DocumentationProvider = documentationProvider;
_compilationImportOptions = compilationImportOptions;
_sourceAssemblySimpleName = sourceAssemblySimpleName;
}
internal override Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol CreateAssemblySymbol()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
return new PEAssemblySymbol(Assembly, DocumentationProvider, ((AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)this).IsLinked, EffectiveImportOptions);
}
protected override void AddAvailableSymbols(ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> assemblies)
{
lock (CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard)
{
foreach (IAssemblySymbolInternal cachedSymbol in CachedSymbols)
{
PEAssemblySymbol pEAssemblySymbol = cachedSymbol as PEAssemblySymbol;
if (IsMatchingAssembly(pEAssemblySymbol))
{
assemblies.Add((Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol)pEAssemblySymbol);
}
}
}
}
public override bool IsMatchingAssembly(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol? candidateAssembly)
{
return IsMatchingAssembly(candidateAssembly as PEAssemblySymbol);
}
private bool IsMatchingAssembly(PEAssemblySymbol? peAssembly)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
if ((object)peAssembly == null)
{
return false;
}
if (peAssembly.Assembly != Assembly)
{
return false;
}
if (EffectiveImportOptions != peAssembly.PrimaryModule.ImportOptions)
{
return false;
}
if (!((object)peAssembly.DocumentationProvider).Equals((object?)DocumentationProvider))
{
return false;
}
return true;
}
}
private sealed class AssemblyDataForCompilation : AssemblyDataForMetadataOrCompilation
{
public readonly CSharpCompilation Compilation;
public override bool ContainsNoPiaLocalTypes => Compilation.MightContainNoPiaLocalTypes();
public override bool DeclaresTheObjectClass => Compilation.DeclaresTheObjectClass;
public override Compilation SourceCompilation => (Compilation)(object)Compilation;
public AssemblyDataForCompilation(CSharpCompilation compilation, bool embedInteropTypes)
: base(compilation.Assembly.Identity, GetReferencedAssemblies(compilation), embedInteropTypes)
{
Compilation = compilation;
}
private static ImmutableArray<AssemblyIdentity> GetReferencedAssemblies(CSharpCompilation compilation)
{
ArrayBuilder<AssemblyIdentity> instance = ArrayBuilder<AssemblyIdentity>.GetInstance();
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> modules = compilation.Assembly.Modules;
ImmutableArray<AssemblyIdentity> referencedAssemblies = modules[0].GetReferencedAssemblies();
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referencedAssemblySymbols = modules[0].GetReferencedAssemblySymbols();
for (int i = 0; i < referencedAssemblies.Length; i++)
{
if (!referencedAssemblySymbols[i].IsLinked)
{
instance.Add(referencedAssemblies[i]);
}
}
for (int j = 1; j < modules.Length; j++)
{
instance.AddRange(modules[j].GetReferencedAssemblies());
}
return instance.ToImmutableAndFree();
}
internal override Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol CreateAssemblySymbol()
{
return new RetargetingAssemblySymbol(Compilation.SourceAssembly, ((AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)this).IsLinked);
}
protected override void AddAvailableSymbols(ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> assemblies)
{
assemblies.Add(Compilation.Assembly);
lock (CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard)
{
((Compilation)Compilation).AddRetargetingAssemblySymbolsNoLock<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(assemblies);
}
}
public override bool IsMatchingAssembly(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol? candidateAssembly)
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol = ((!(candidateAssembly is RetargetingAssemblySymbol retargetingAssemblySymbol)) ? (candidateAssembly as Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol) : retargetingAssemblySymbol.UnderlyingAssembly);
return (object)assemblySymbol == Compilation.Assembly;
}
}
protected override CommonMessageProvider MessageProvider => (CommonMessageProvider)(object)Microsoft.CodeAnalysis.CSharp.MessageProvider.Instance;
public ReferenceManager(string simpleAssemblyName, AssemblyIdentityComparer identityComparer, Dictionary<MetadataReference, object>? observedMetadata)
: base(simpleAssemblyName, identityComparer, observedMetadata)
{
}
protected override AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> CreateAssemblyDataForFile(PEAssembly assembly, WeakList<IAssemblySymbolInternal> cachedSymbols, DocumentationProvider documentationProvider, string sourceAssemblySimpleName, MetadataImportOptions importOptions, bool embedInteropTypes)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return (AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)new AssemblyDataForFile(assembly, cachedSymbols, embedInteropTypes, documentationProvider, sourceAssemblySimpleName, importOptions);
}
protected override AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> CreateAssemblyDataForCompilation(CompilationReference compilationReference)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (!(compilationReference is CSharpCompilationReference cSharpCompilationReference))
{
throw new NotSupportedException(string.Format(CSharpResources.CantReferenceCompilationOf, ((object)compilationReference).GetType(), "C#"));
}
CSharpCompilation compilation = cSharpCompilationReference.Compilation;
MetadataReferenceProperties properties = ((MetadataReference)cSharpCompilationReference).Properties;
return (AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)new AssemblyDataForCompilation(compilation, ((MetadataReferenceProperties)(ref properties)).EmbedInteropTypes);
}
protected override bool CheckPropertiesConsistency(MetadataReference primaryReference, MetadataReference duplicateReference, DiagnosticBag diagnostics)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
MetadataReferenceProperties properties = primaryReference.Properties;
bool embedInteropTypes = ((MetadataReferenceProperties)(ref properties)).EmbedInteropTypes;
properties = duplicateReference.Properties;
if (embedInteropTypes != ((MetadataReferenceProperties)(ref properties)).EmbedInteropTypes)
{
diagnostics.Add(ErrorCode.ERR_AssemblySpecifiedForLinkAndRef, NoLocation.Singleton, duplicateReference.Display, primaryReference.Display);
return false;
}
return true;
}
protected override bool WeakIdentityPropertiesEquivalent(AssemblyIdentity identity1, AssemblyIdentity identity2)
{
return AssemblyIdentityComparer.CultureComparer.Equals(identity1.CultureName, identity2.CultureName);
}
protected override void GetActualBoundReferencesUsedBy(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol, List<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol?> referencedAssemblySymbols)
{
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol>.Enumerator enumerator = assemblySymbol.Modules.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol current = enumerator.Current;
referencedAssemblySymbols.AddRange(current.GetReferencedAssemblySymbols());
}
for (int i = 0; i < referencedAssemblySymbols.Count; i++)
{
if (referencedAssemblySymbols[i].IsMissing)
{
referencedAssemblySymbols[i] = null;
}
}
}
protected override ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> GetNoPiaResolutionAssemblies(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol candidateAssembly)
{
if (candidateAssembly is Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol)
{
return ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Empty;
}
return candidateAssembly.GetNoPiaResolutionAssemblies();
}
protected override bool IsLinked(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol candidateAssembly)
{
return candidateAssembly.IsLinked;
}
protected override Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol? GetCorLibrary(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol candidateAssembly)
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol corLibrary = candidateAssembly.CorLibrary;
if (!corLibrary.IsMissing)
{
return corLibrary;
}
return null;
}
public void CreateSourceAssemblyForCompilation(CSharpCompilation compilation)
{
if (base.IsBound || !CreateAndSetSourceAssemblyFullBind(compilation))
{
if (!base.HasCircularReference)
{
CreateAndSetSourceAssemblyReuseData(compilation);
}
else
{
new ReferenceManager(base.SimpleAssemblyName, base.IdentityComparer, base.ObservedMetadata).CreateAndSetSourceAssemblyFullBind(compilation);
}
}
}
public PEAssemblySymbol CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata metadata, MetadataImportOptions importOptions, out ImmutableDictionary<AssemblyIdentity, AssemblyIdentity> assemblyReferenceIdentityMap)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> val = new AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>();
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Enumerator enumerator = base.ReferencedAssemblies.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol current = enumerator.Current;
val.Add(current.Identity, current);
}
PEAssembly assembly = metadata.GetAssembly();
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> immutableArray = ImmutableArrayExtensions.SelectAsArray<AssemblyIdentity, AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(assembly.AssemblyReferences, (Func<AssemblyIdentity, AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)MapAssemblyIdentityToResolvedSymbol, val);
assemblyReferenceIdentityMap = CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.GetAssemblyReferenceIdentityBaselineMap(immutableArray, assembly.AssemblyReferences);
PEAssemblySymbol pEAssemblySymbol = new PEAssemblySymbol(assembly, DocumentationProvider.Default, isLinked: false, importOptions);
ImmutableArray<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> unifiedAssemblies = ImmutableArrayExtensions.WhereAsArray<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>, AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>(base.UnifiedAssemblies, (Func<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>, AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>, bool>)((UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> unified, AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referencedAssembliesByIdentity) => referencedAssembliesByIdentity.Contains(unified.OriginalReference, false)), val);
InitializeAssemblyReuseData(pEAssemblySymbol, immutableArray, unifiedAssemblies);
if (assembly.ContainsNoPiaLocalTypes())
{
pEAssemblySymbol.SetNoPiaResolutionAssemblies(base.ReferencedAssemblies);
}
return pEAssemblySymbol;
}
private static Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol MapAssemblyIdentityToResolvedSymbol(AssemblyIdentity identity, AssemblyIdentityMap<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> map)
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol = default(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol);
if (map.TryGetValue(identity, ref assemblySymbol, (Func<Version, Version, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, bool>)CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.CompareVersionPartsSpecifiedInSource))
{
return assemblySymbol;
}
if (map.TryGetValue(identity, ref assemblySymbol, (Func<Version, Version, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, bool>)((Version v1, Version v2, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol s) => true)))
{
throw new NotSupportedException(string.Format(CodeAnalysisResources.ChangingVersionOfAssemblyReferenceIsNotAllowedDuringDebugging, identity, assemblySymbol.Identity.Version));
}
return new MissingAssemblySymbol(identity);
}
private void CreateAndSetSourceAssemblyReuseData(CSharpCompilation compilation)
{
string moduleName = ((Compilation)compilation).MakeSourceModuleName();
Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssemblySymbol = new Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol(compilation, base.SimpleAssemblyName, moduleName, base.ReferencedModules);
InitializeAssemblyReuseData(sourceAssemblySymbol, base.ReferencedAssemblies, base.UnifiedAssemblies);
if ((object)compilation._lazyAssemblySymbol != null)
{
return;
}
lock (CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard)
{
if ((object)compilation._lazyAssemblySymbol == null)
{
compilation._lazyAssemblySymbol = sourceAssemblySymbol;
}
}
}
private void InitializeAssemblyReuseData(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol, ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referencedAssemblies, ImmutableArray<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> unifiedAssemblies)
{
assemblySymbol.SetCorLibrary(base.CorLibraryOpt ?? assemblySymbol);
ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> moduleReferences = new ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(ImmutableArrayExtensions.SelectAsArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, AssemblyIdentity>(referencedAssemblies, (Func<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, AssemblyIdentity>)((Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol a) => a.Identity)), referencedAssemblies, unifiedAssemblies);
assemblySymbol.Modules[0].SetReferences(moduleReferences);
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> modules = assemblySymbol.Modules;
ImmutableArray<ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> referencedModulesReferences = base.ReferencedModulesReferences;
for (int num = 1; num < modules.Length; num++)
{
modules[num].SetReferences(referencedModulesReferences[num - 1]);
}
}
private bool CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
DiagnosticBag instance = DiagnosticBag.GetInstance();
PooledDictionary<string, List<ReferencedAssemblyIdentity<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>> instance2 = PooledDictionary<string, List<ReferencedAssemblyIdentity<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>>.GetInstance();
bool referencesSupersedeLowerVersions = ((CompilationOptions)compilation.Options).ReferencesSupersedeLowerVersions;
try
{
ImmutableArray<MetadataReference> immutableArray2 = default(ImmutableArray<MetadataReference>);
IDictionary<(string, string), MetadataReference> dictionary = default(IDictionary<(string, string), MetadataReference>);
ImmutableArray<MetadataReference> immutableArray3 = default(ImmutableArray<MetadataReference>);
ImmutableArray<AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> immutableArray4 = default(ImmutableArray<AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>);
ImmutableArray<PEModule> immutableArray5 = default(ImmutableArray<PEModule>);
ImmutableArray<ResolvedReference<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> immutableArray = base.ResolveMetadataReferences(compilation, (Dictionary<string, List<ReferencedAssemblyIdentity<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>>)(object)instance2, ref immutableArray2, ref dictionary, ref immutableArray3, ref immutableArray4, ref immutableArray5, instance);
AssemblyDataForAssemblyBeingBuilt<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> item = new AssemblyDataForAssemblyBeingBuilt<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(new AssemblyIdentity(true, base.SimpleAssemblyName, (Version)null, (string)null, default(ImmutableArray<byte>), false, false, AssemblyContentType.Default), immutableArray4, immutableArray5);
ImmutableArray<AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> immutableArray6 = immutableArray4.Insert(0, (AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)item);
CSharpScriptCompilationInfo? scriptCompilationInfo = compilation.ScriptCompilationInfo;
object obj;
if (scriptCompilationInfo == null)
{
obj = null;
}
else
{
CSharpCompilation? previousScriptCompilation = scriptCompilationInfo.PreviousScriptCompilation;
obj = ((previousScriptCompilation != null) ? ((CommonReferenceManager)previousScriptCompilation.GetBoundReferenceManager()).ImplicitReferenceResolutions : null);
}
if (obj == null)
{
obj = ImmutableDictionary<AssemblyIdentity, PortableExecutableReference>.Empty;
}
ImmutableDictionary<AssemblyIdentity, PortableExecutableReference> immutableDictionary = (ImmutableDictionary<AssemblyIdentity, PortableExecutableReference>)obj;
ImmutableArray<AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> assemblies = default(ImmutableArray<AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>);
ImmutableArray<MetadataReference> items = default(ImmutableArray<MetadataReference>);
ImmutableArray<ResolvedReference<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> items2 = default(ImmutableArray<ResolvedReference<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>);
bool flag = default(bool);
int num = default(int);
BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] array = base.Bind(immutableArray6, immutableArray5, immutableArray2, immutableArray, ((CompilationOptions)compilation.Options).MetadataReferenceResolver, ((CompilationOptions)compilation.Options).MetadataImportOptions, referencesSupersedeLowerVersions, (Dictionary<string, List<ReferencedAssemblyIdentity<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>>)(object)instance2, ref assemblies, ref items, ref items2, ref immutableDictionary, instance, ref flag, ref num);
ImmutableArray<MetadataReference> immutableArray7 = immutableArray2.AddRange(items);
immutableArray = immutableArray.AddRange(items2);
Dictionary<MetadataReference, int> dictionary2 = default(Dictionary<MetadataReference, int>);
Dictionary<MetadataReference, int> dictionary3 = default(Dictionary<MetadataReference, int>);
ImmutableArray<ImmutableArray<string>> immutableArray8 = default(ImmutableArray<ImmutableArray<string>>);
Dictionary<MetadataReference, ImmutableArray<MetadataReference>> dictionary4 = default(Dictionary<MetadataReference, ImmutableArray<MetadataReference>>);
CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.BuildReferencedAssembliesAndModulesMaps(array, immutableArray7, immutableArray, immutableArray5.Length, immutableArray4.Length, (IReadOnlyDictionary<string, List<ReferencedAssemblyIdentity<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>>)instance2, referencesSupersedeLowerVersions, ref dictionary2, ref dictionary3, ref immutableArray8, ref dictionary4);
List<int> list = new List<int>();
for (int i = 1; i < array.Length; i++)
{
ref BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> reference = ref array[i];
if ((object)reference.AssemblySymbol == null)
{
reference.AssemblySymbol = ((AssemblyDataForMetadataOrCompilation)(object)assemblies[i]).CreateAssemblySymbol();
list.Add(i);
}
}
Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssemblySymbol = new Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol(compilation, base.SimpleAssemblyName, ((Compilation)compilation).MakeSourceModuleName(), immutableArray5);
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol = ((num == 0) ? sourceAssemblySymbol : ((num <= 0) ? MissingCorLibrarySymbol.Instance : array[num].AssemblySymbol));
sourceAssemblySymbol.SetCorLibrary(assemblySymbol);
Dictionary<AssemblyIdentity, MissingAssemblySymbol> missingAssemblies = null;
int totalReferencedAssemblyCount = assemblies.Length - 1;
SetupReferencesForSourceAssembly(sourceAssemblySymbol, immutableArray5, totalReferencedAssemblyCount, array, ref missingAssemblies, out ImmutableArray<ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> moduleReferences);
if (list.Count > 0)
{
if (flag)
{
array[0].AssemblySymbol = sourceAssemblySymbol;
}
InitializeNewSymbols(list, sourceAssemblySymbol, assemblies, array, missingAssemblies);
}
if ((object)compilation._lazyAssemblySymbol == null)
{
lock (CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard)
{
if ((object)compilation._lazyAssemblySymbol == null)
{
if (base.IsBound)
{
return false;
}
UpdateSymbolCacheNoLock(list, assemblies, array);
base.InitializeNoLock(dictionary2, dictionary3, dictionary, immutableArray3, immutableArray2, immutableDictionary, flag, instance.ToReadOnly(), ((object)assemblySymbol == sourceAssemblySymbol) ? null : assemblySymbol, immutableArray5, moduleReferences, sourceAssemblySymbol.SourceModule.GetReferencedAssemblySymbols(), immutableArray8, sourceAssemblySymbol.SourceModule.GetUnifiedAssemblies(), dictionary4);
compilation._referenceManager = this;
compilation._lazyAssemblySymbol = sourceAssemblySymbol;
}
}
}
return true;
}
finally
{
instance.Free();
instance2.Free();
}
}
private static void InitializeNewSymbols(List<int> newSymbols, Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssembly, ImmutableArray<AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> assemblies, BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] bindingResult, Dictionary<AssemblyIdentity, MissingAssemblySymbol>? missingAssemblies)
{
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol corLibrary = sourceAssembly.CorLibrary;
foreach (int newSymbol in newSymbols)
{
if (assemblies[newSymbol] is AssemblyDataForCompilation)
{
SetupReferencesForRetargetingAssembly(bindingResult, ref bindingResult[newSymbol], ref missingAssemblies, sourceAssembly);
}
else
{
SetupReferencesForFileAssembly((AssemblyDataForFile)(object)assemblies[newSymbol], bindingResult, ref bindingResult[newSymbol], ref missingAssemblies, sourceAssembly);
}
}
ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> instance = ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.GetInstance();
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referencedAssemblySymbols = sourceAssembly.Modules[0].GetReferencedAssemblySymbols();
foreach (int newSymbol2 in newSymbols)
{
ref BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> reference = ref bindingResult[newSymbol2];
if (assemblies[newSymbol2].ContainsNoPiaLocalTypes)
{
reference.AssemblySymbol.SetNoPiaResolutionAssemblies(referencedAssemblySymbols);
}
instance.Clear();
if (assemblies[newSymbol2].IsLinked)
{
instance.Add(reference.AssemblySymbol);
}
AssemblyReferenceBinding<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] referenceBinding = reference.ReferenceBinding;
for (int i = 0; i < referenceBinding.Length; i++)
{
AssemblyReferenceBinding<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> val = referenceBinding[i];
if (val.IsBound && assemblies[val.DefinitionIndex].IsLinked)
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol = bindingResult[val.DefinitionIndex].AssemblySymbol;
instance.Add(assemblySymbol);
}
}
if (instance.Count > 0)
{
instance.RemoveDuplicates();
reference.AssemblySymbol.SetLinkedReferencedAssemblies(instance.ToImmutable());
}
reference.AssemblySymbol.SetCorLibrary(corLibrary);
}
instance.Free();
if (missingAssemblies == null)
{
return;
}
foreach (MissingAssemblySymbol value in missingAssemblies.Values)
{
value.SetCorLibrary(corLibrary);
}
}
private static void UpdateSymbolCacheNoLock(List<int> newSymbols, ImmutableArray<AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> assemblies, BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] bindingResult)
{
foreach (int newSymbol in newSymbols)
{
ref BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> reference = ref bindingResult[newSymbol];
if (assemblies[newSymbol] is AssemblyDataForCompilation assemblyDataForCompilation)
{
((Compilation)assemblyDataForCompilation.Compilation).CacheRetargetingAssemblySymbolNoLock((IAssemblySymbolInternal)(object)reference.AssemblySymbol);
}
else
{
((AssemblyDataForFile)(object)assemblies[newSymbol]).CachedSymbols.Add((IAssemblySymbolInternal)(object)(PEAssemblySymbol)reference.AssemblySymbol);
}
}
}
private static void SetupReferencesForRetargetingAssembly(BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] bindingResult, ref BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> currentBindingResult, ref Dictionary<AssemblyIdentity, MissingAssemblySymbol>? missingAssemblies, Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssemblyDebugOnly)
{
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
RetargetingAssemblySymbol retargetingAssemblySymbol = (RetargetingAssemblySymbol)currentBindingResult.AssemblySymbol;
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> modules = retargetingAssemblySymbol.Modules;
int length = modules.Length;
int num = 0;
for (int i = 0; i < length; i++)
{
ImmutableArray<AssemblyIdentity> immutableArray = retargetingAssemblySymbol.UnderlyingAssembly.Modules[i].GetReferencedAssemblies();
if (i == 0)
{
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referencedAssemblySymbols = retargetingAssemblySymbol.UnderlyingAssembly.Modules[0].GetReferencedAssemblySymbols();
int num2 = 0;
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Enumerator enumerator = referencedAssemblySymbols.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Current.IsLinked)
{
num2++;
}
}
if (num2 > 0)
{
AssemblyIdentity[] array = (AssemblyIdentity[])(object)new AssemblyIdentity[immutableArray.Length - num2];
int num3 = 0;
for (int j = 0; j < referencedAssemblySymbols.Length; j++)
{
if (!referencedAssemblySymbols[j].IsLinked)
{
array[num3] = immutableArray[j];
num3++;
}
}
immutableArray = ImmutableArrayExtensions.AsImmutableOrNull<AssemblyIdentity>(array);
}
}
int length2 = immutableArray.Length;
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol[] array2 = new Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol[length2];
ArrayBuilder<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> unifiedAssemblies = null;
for (int k = 0; k < length2; k++)
{
AssemblyReferenceBinding<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referenceBinding = currentBindingResult.ReferenceBinding[num + k];
if (referenceBinding.IsBound)
{
array2[k] = GetAssemblyDefinitionSymbol(bindingResult, referenceBinding, ref unifiedAssemblies);
}
else
{
array2[k] = GetOrAddMissingAssemblySymbol(immutableArray[k], ref missingAssemblies);
}
}
ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> moduleReferences = new ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(immutableArray, ImmutableArrayExtensions.AsImmutableOrNull<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(array2), ImmutableArrayExtensions.AsImmutableOrEmpty<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>((IEnumerable<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>)unifiedAssemblies));
modules[i].SetReferences(moduleReferences, sourceAssemblyDebugOnly);
num += length2;
}
}
private static void SetupReferencesForFileAssembly(AssemblyDataForFile fileData, BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] bindingResult, ref BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> currentBindingResult, ref Dictionary<AssemblyIdentity, MissingAssemblySymbol>? missingAssemblies, Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssemblyDebugOnly)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> modules = ((PEAssemblySymbol)currentBindingResult.AssemblySymbol).Modules;
int length = modules.Length;
int num = 0;
for (int i = 0; i < length; i++)
{
int num2 = fileData.Assembly.ModuleReferenceCounts[i];
AssemblyIdentity[] array = (AssemblyIdentity[])(object)new AssemblyIdentity[num2];
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol[] array2 = new Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol[num2];
((AssemblyData<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)fileData).AssemblyReferences.CopyTo(num, array, 0, num2);
ArrayBuilder<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> unifiedAssemblies = null;
for (int j = 0; j < num2; j++)
{
AssemblyReferenceBinding<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referenceBinding = currentBindingResult.ReferenceBinding[num + j];
if (referenceBinding.IsBound)
{
array2[j] = GetAssemblyDefinitionSymbol(bindingResult, referenceBinding, ref unifiedAssemblies);
}
else
{
array2[j] = GetOrAddMissingAssemblySymbol(array[j], ref missingAssemblies);
}
}
ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> moduleReferences = new ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(ImmutableArrayExtensions.AsImmutableOrNull<AssemblyIdentity>(array), ImmutableArrayExtensions.AsImmutableOrNull<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(array2), ImmutableArrayExtensions.AsImmutableOrEmpty<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>((IEnumerable<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>)unifiedAssemblies));
modules[i].SetReferences(moduleReferences, sourceAssemblyDebugOnly);
num += num2;
}
}
private static void SetupReferencesForSourceAssembly(Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssembly, ImmutableArray<PEModule> modules, int totalReferencedAssemblyCount, BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] bindingResult, ref Dictionary<AssemblyIdentity, MissingAssemblySymbol>? missingAssemblies, out ImmutableArray<ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> moduleReferences)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> modules2 = sourceAssembly.Modules;
ArrayBuilder<ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> val = ((modules2.Length > 1) ? ArrayBuilder<ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>.GetInstance() : null);
int num = 0;
for (int i = 0; i < modules2.Length; i++)
{
int num2 = ((i == 0) ? totalReferencedAssemblyCount : modules[i - 1].ReferencedAssemblies.Length);
AssemblyIdentity[] array = (AssemblyIdentity[])(object)new AssemblyIdentity[num2];
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol[] array2 = new Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol[num2];
ArrayBuilder<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> unifiedAssemblies = null;
for (int j = 0; j < num2; j++)
{
AssemblyReferenceBinding<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referenceBinding = bindingResult[0].ReferenceBinding[num + j];
if (referenceBinding.IsBound)
{
array2[j] = GetAssemblyDefinitionSymbol(bindingResult, referenceBinding, ref unifiedAssemblies);
}
else
{
array2[j] = GetOrAddMissingAssemblySymbol(referenceBinding.ReferenceIdentity, ref missingAssemblies);
}
array[j] = referenceBinding.ReferenceIdentity;
}
ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> val2 = new ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(ImmutableArrayExtensions.AsImmutableOrNull<AssemblyIdentity>(array), ImmutableArrayExtensions.AsImmutableOrNull<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(array2), ImmutableArrayExtensions.AsImmutableOrEmpty<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>((IEnumerable<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>)unifiedAssemblies));
if (i > 0)
{
val.Add(val2);
}
modules2[i].SetReferences(val2, sourceAssembly);
num += num2;
}
moduleReferences = ArrayBuilderExtensions.ToImmutableOrEmptyAndFree<ModuleReferences<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>(val);
}
private static Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol GetAssemblyDefinitionSymbol(BoundInputAssembly<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>[] bindingResult, AssemblyReferenceBinding<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> referenceBinding, ref ArrayBuilder<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>? unifiedAssemblies)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol = bindingResult[referenceBinding.DefinitionIndex].AssemblySymbol;
if (referenceBinding.VersionDifference != 0)
{
if (unifiedAssemblies == null)
{
unifiedAssemblies = new ArrayBuilder<UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>();
}
unifiedAssemblies.Add(new UnifiedAssembly<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(assemblySymbol, referenceBinding.ReferenceIdentity));
}
return assemblySymbol;
}
private static MissingAssemblySymbol GetOrAddMissingAssemblySymbol(AssemblyIdentity assemblyIdentity, ref Dictionary<AssemblyIdentity, MissingAssemblySymbol>? missingAssemblies)
{
MissingAssemblySymbol value;
if (missingAssemblies == null)
{
missingAssemblies = new Dictionary<AssemblyIdentity, MissingAssemblySymbol>();
}
else if (missingAssemblies.TryGetValue(assemblyIdentity, out value))
{
return value;
}
value = new MissingAssemblySymbol(assemblyIdentity);
missingAssemblies.Add(assemblyIdentity, value);
return value;
}
internal static bool IsSourceAssemblySymbolCreated(CSharpCompilation compilation)
{
return (object)compilation._lazyAssemblySymbol != null;
}
internal static bool IsReferenceManagerInitialized(CSharpCompilation compilation)
{
return ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)compilation._referenceManager).IsBound;
}
}
private readonly CSharpCompilationOptions _options;
private readonly Lazy<UsingsFromOptionsAndDiagnostics> _usingsFromOptions;
private readonly Lazy<ImmutableArray<NamespaceOrTypeAndUsingDirective>> _globalImports;
private readonly Lazy<Imports> _previousSubmissionImports;
private readonly Lazy<Microsoft.CodeAnalysis.CSharp.Symbols.AliasSymbol> _globalNamespaceAlias;
private readonly Lazy<ImplicitNamedTypeSymbol?> _scriptClass;
private Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol? _lazyHostObjectTypeSymbol;
private ConcurrentDictionary<ImportInfo, ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>>? _lazyImportInfos;
private ImmutableArray<Diagnostic> _lazyClsComplianceDiagnostics;
private ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> _lazyClsComplianceDependencies;
private Conversions? _conversions;
private readonly AnonymousTypeManager _anonymousTypeManager;
private Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol? _lazyGlobalNamespace;
internal readonly BuiltInOperators builtInOperators;
private Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol? _lazyAssemblySymbol;
private ReferenceManager _referenceManager;
private readonly SyntaxAndDeclarationManager _syntaxAndDeclarations;
private EntryPoint? _lazyEntryPoint;
private ThreeState _lazyEmitNullablePublicOnly;
private HashSet<SyntaxTree>? _lazyCompilationUnitCompletedTrees;
private ImmutableHashSet<SyntaxTree>? _usageOfUsingsRecordedInTrees = ImmutableHashSet<SyntaxTree>.Empty;
internal object? TestOnlyCompilationData;
private readonly ConcurrentCache<Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol> _typeToNullableVersion = new ConcurrentCache<Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol>(100);
private ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> _mappedPathToSyntaxTree;
private static readonly CSharpCompilationOptions s_defaultOptions = new CSharpCompilationOptions((OutputKind)0, reportSuppressedDiagnostics: false, null, null, null, null, (OptimizationLevel)0, checkOverflow: false, allowUnsafe: false, null, null, default(ImmutableArray<byte>), null, (Platform)0, (ReportDiagnostic)0, 4, null, concurrentBuild: true, deterministic: false, null, null, null, null, null, publicSign: false, (MetadataImportOptions)0, (NullableContextOptions)0);
private static readonly CSharpCompilationOptions s_defaultSubmissionOptions = new CSharpCompilationOptions((OutputKind)2, reportSuppressedDiagnostics: false, null, null, null, null, (OptimizationLevel)0, checkOverflow: false, allowUnsafe: false, null, null, default(ImmutableArray<byte>), null, (Platform)0, (ReportDiagnostic)0, 4, null, concurrentBuild: true, deterministic: false, null, null, null, null, null, publicSign: false, (MetadataImportOptions)0, (NullableContextOptions)0).WithReferencesSupersedeLowerVersions(value: true);
private ConcurrentDictionary<string, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>? _externAliasTargets;
private ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>? _moduleInitializerMethods;
private ConcurrentDictionary<(string FilePath, int Line, int Character), OneOrMany<(Location AttributeLocation, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol Interceptor)>>? _interceptions;
private WeakReference<BinderFactory>[]? _binderFactories;
private WeakReference<BinderFactory>[]? _ignoreAccessibilityBinderFactories;
private DiagnosticBag? _lazyDeclarationDiagnostics;
private bool _declarationDiagnosticsFrozen;
private readonly DiagnosticBag _additionalCodegenWarnings = new DiagnosticBag();
private ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>? _lazyUsedAssemblyReferences;
private bool _usedAssemblyReferencesFrozen;
internal readonly WellKnownMembersSignatureComparer WellKnownMemberSignatureComparer;
private Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol?[]? _lazyWellKnownTypes;
private Symbol?[]? _lazyWellKnownTypeMembers;
private bool _usesNullableAttributes;
private int _needsGeneratedAttributes;
private bool _needsGeneratedAttributes_IsFrozen;
internal Conversions Conversions
{
get
{
if (_conversions == null)
{
Interlocked.CompareExchange(ref _conversions, new BuckStopsHereBinder(this, null).Conversions, null);
}
return _conversions;
}
}
internal ImmutableHashSet<SyntaxTree>? UsageOfUsingsRecordedInTrees => Volatile.Read(in _usageOfUsingsRecordedInTrees);
public override string Language => "C#";
public override bool IsCaseSensitive => true;
public CSharpCompilationOptions Options => _options;
internal AnonymousTypeManager AnonymousTypeManager => _anonymousTypeManager;
internal override CommonAnonymousTypeManager CommonAnonymousTypeManager => (CommonAnonymousTypeManager)(object)AnonymousTypeManager;
internal bool FeatureStrictEnabled => ((Compilation)this).Feature("strict") != null;
internal bool IsPeVerifyCompatEnabled
{
get
{
if (LanguageVersion >= LanguageVersion.CSharp7_2)
{
return ((Compilation)this).Feature("peverify-compat") != null;
}
return true;
}
}
internal bool FeatureDisableLengthBasedSwitch => ((Compilation)this).Feature("disable-length-based-switch") != null;
internal bool IsNullableAnalysisEnabledAlways => GetNullableAnalysisValue() == true;
public LanguageVersion LanguageVersion { get; }
public CSharpScriptCompilationInfo? ScriptCompilationInfo { get; }
internal override ScriptCompilationInfo? CommonScriptCompilationInfo => (ScriptCompilationInfo?)(object)ScriptCompilationInfo;
internal CSharpCompilation? PreviousSubmission => ScriptCompilationInfo?.PreviousScriptCompilation;
public ImmutableArray<SyntaxTree> SyntaxTrees => _syntaxAndDeclarations.GetLazyState().SyntaxTrees;
public override ImmutableArray<MetadataReference> DirectiveReferences => ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).DirectiveReferences;
internal override IDictionary<(string path, string content), MetadataReference> ReferenceDirectiveMap => ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).ReferenceDirectiveMap;
internal IEnumerable<string> ExternAliases => ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).ExternAliases;
public override IEnumerable<AssemblyIdentity> ReferencedAssemblyNames => Assembly.Modules.SelectMany((Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol module) => module.GetReferencedAssemblies());
internal override IEnumerable<ReferenceDirective> ReferenceDirectives => Declarations.ReferenceDirectives;
internal Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol SourceAssembly
{
get
{
GetBoundReferenceManager();
return _lazyAssemblySymbol;
}
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol Assembly => SourceAssembly;
internal Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol SourceModule => Assembly.Modules[0];
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol GlobalNamespace
{
get
{
if ((object)_lazyGlobalNamespace == null)
{
ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> instance = ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol>.GetInstance();
GetAllUnaliasedModules(instance);
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol value = MergedNamespaceSymbol.Create(new NamespaceExtent(this), null, instance.SelectDistinct<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>((Func<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>)((Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol m) => m.GlobalNamespace)));
instance.Free();
Interlocked.CompareExchange(ref _lazyGlobalNamespace, value, null);
}
return _lazyGlobalNamespace;
}
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol? ScriptClass => _scriptClass.Value;
internal ImmutableArray<NamespaceOrTypeAndUsingDirective> GlobalImports => _globalImports.Value;
private UsingsFromOptionsAndDiagnostics UsingsFromOptions => _usingsFromOptions.Value;
internal Microsoft.CodeAnalysis.CSharp.Symbols.AliasSymbol GlobalNamespaceAlias => _globalNamespaceAlias.Value;
protected override ITypeSymbol? CommonScriptGlobalsType => GetHostObjectTypeSymbol()?.GetPublicSymbol();
internal Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol DynamicType => Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol.DynamicType;
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol ObjectType => Assembly.ObjectType;
internal bool DeclaresTheObjectClass => SourceAssembly.DeclaresTheObjectClass;
internal override CommonMessageProvider MessageProvider => ((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).MessageProvider;
internal DiagnosticBag DeclarationDiagnostics
{
get
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
if (_lazyDeclarationDiagnostics == null)
{
DiagnosticBag value = new DiagnosticBag();
Interlocked.CompareExchange(ref _lazyDeclarationDiagnostics, value, null);
}
return _lazyDeclarationDiagnostics;
}
}
internal DiagnosticBag AdditionalCodegenWarnings => _additionalCodegenWarnings;
internal DeclarationTable Declarations => _syntaxAndDeclarations.GetLazyState().DeclarationTable;
internal MergedNamespaceDeclaration MergedRootDeclaration => Declarations.GetMergedRoot(this);
internal override byte LinkerMajorVersion => 48;
internal override bool IsDelaySigned => SourceAssembly.IsDelaySigned;
internal override StrongNameKeys StrongNameKeys => SourceAssembly.StrongNameKeys;
internal override Guid DebugSourceDocumentLanguageId => DebugSourceDocument.CorSymLanguageTypeCSharp;
protected override IAssemblySymbol CommonAssembly => Assembly.GetPublicSymbol();
protected override INamespaceSymbol CommonGlobalNamespace => GlobalNamespace.GetPublicSymbol();
protected override CompilationOptions CommonOptions => (CompilationOptions)(object)_options;
protected internal override ImmutableArray<SyntaxTree> CommonSyntaxTrees => SyntaxTrees;
protected override IModuleSymbol CommonSourceModule => SourceModule.GetPublicSymbol();
protected override INamedTypeSymbol? CommonScriptClass => ScriptClass.GetPublicSymbol();
protected override ITypeSymbol CommonDynamicType => DynamicType.GetPublicSymbol();
protected override INamedTypeSymbol CommonObjectType => ObjectType.GetPublicSymbol();
internal bool EmitNullablePublicOnly
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
if (!ThreeStateHelpers.HasValue(_lazyEmitNullablePublicOnly))
{
SyntaxTree? obj = SyntaxTrees.FirstOrDefault();
int num;
if (obj == null)
{
num = 0;
}
else
{
ParseOptions options = obj.Options;
num = ((((options == null) ? ((bool?)null) : options.Features?.ContainsKey("nullablePublicOnly")) == true) ? 1 : 0);
}
bool flag = (byte)num != 0;
_lazyEmitNullablePublicOnly = ThreeStateHelpers.ToThreeState(flag);
}
return ThreeStateHelpers.Value(_lazyEmitNullablePublicOnly);
}
}
internal bool EnableEnumArrayBlockInitialization
{
get
{
Symbol wellKnownTypeMember = GetWellKnownTypeMember((WellKnownMember)307);
if (wellKnownTypeMember != null)
{
return wellKnownTypeMember.ContainingAssembly == Assembly.CorLibrary;
}
return false;
}
}
internal bool IsNullableAnalysisEnabledIn(SyntaxNode syntax)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
return IsNullableAnalysisEnabledIn((CSharpSyntaxTree)(object)syntax.SyntaxTree, syntax.Span);
}
internal bool IsNullableAnalysisEnabledIn(CSharpSyntaxTree tree, TextSpan span)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
return GetNullableAnalysisValue() ?? tree.IsNullableAnalysisEnabled(span) ?? ((((CompilationOptions)Options).NullableContextOptions & 1) > 0);
}
internal bool IsNullableAnalysisEnabledIn(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method)
{
return GetNullableAnalysisValue() ?? method.IsNullableAnalysisEnabled();
}
private bool? GetNullableAnalysisValue()
{
string text = ((Compilation)this).Feature("run-nullable-analysis");
if (!(text == "always"))
{
if (text == "never")
{
return false;
}
return null;
}
return true;
}
protected override INamedTypeSymbol CommonCreateErrorTypeSymbol(INamespaceOrTypeSymbol? container, string name, int arity)
{
return new ExtendedErrorTypeSymbol(container.EnsureCSharpSymbolOrNull("container"), name, arity, null).GetPublicSymbol();
}
protected override INamespaceSymbol CommonCreateErrorNamespaceSymbol(INamespaceSymbol container, string name)
{
return new MissingNamespaceSymbol(container.EnsureCSharpSymbolOrNull("container"), name).GetPublicSymbol();
}
public static CSharpCompilation Create(string? assemblyName, IEnumerable<SyntaxTree>? syntaxTrees = null, IEnumerable<MetadataReference>? references = null, CSharpCompilationOptions? options = null)
{
return Create(assemblyName, options ?? s_defaultOptions, syntaxTrees, references, null, null, null, isSubmission: false);
}
public static CSharpCompilation CreateScriptCompilation(string assemblyName, SyntaxTree? syntaxTree = null, IEnumerable<MetadataReference>? references = null, CSharpCompilationOptions? options = null, CSharpCompilation? previousScriptCompilation = null, Type? returnType = null, Type? globalsType = null)
{
Compilation.CheckSubmissionOptions((CompilationOptions)(object)options);
Compilation.ValidateScriptCompilationParameters((Compilation)(object)previousScriptCompilation, returnType, ref globalsType);
CSharpCompilationOptions options2 = options?.WithReferencesSupersedeLowerVersions(value: true) ?? s_defaultSubmissionOptions;
IEnumerable<SyntaxTree> syntaxTrees;
if (syntaxTree == null)
{
syntaxTrees = SpecializedCollections.EmptyEnumerable<SyntaxTree>();
}
else
{
IEnumerable<SyntaxTree> enumerable = (IEnumerable<SyntaxTree>)(object)new SyntaxTree[1] { syntaxTree };
syntaxTrees = enumerable;
}
return Create(assemblyName, options2, syntaxTrees, references, previousScriptCompilation, returnType, globalsType, isSubmission: true);
}
private static CSharpCompilation Create(string? assemblyName, CSharpCompilationOptions options, IEnumerable<SyntaxTree>? syntaxTrees, IEnumerable<MetadataReference>? references, CSharpCompilation? previousSubmission, Type? returnType, Type? hostObjectType, bool isSubmission)
{
ImmutableArray<MetadataReference> references2 = Compilation.ValidateReferences<CSharpCompilationReference>(references);
CSharpCompilation cSharpCompilation = new CSharpCompilation(assemblyName, options, references2, previousSubmission, returnType, hostObjectType, isSubmission, null, reuseReferenceManager: false, new SyntaxAndDeclarationManager(ImmutableArray<SyntaxTree>.Empty, ((CompilationOptions)options).ScriptClassName, ((CompilationOptions)options).SourceReferenceResolver, (CommonMessageProvider)(object)Microsoft.CodeAnalysis.CSharp.MessageProvider.Instance, isSubmission, null), null);
if (syntaxTrees != null)
{
cSharpCompilation = cSharpCompilation.AddSyntaxTrees(syntaxTrees);
}
return cSharpCompilation;
}
private CSharpCompilation(string? assemblyName, CSharpCompilationOptions options, ImmutableArray<MetadataReference> references, CSharpCompilation? previousSubmission, Type? submissionReturnType, Type? hostObjectType, bool isSubmission, ReferenceManager? referenceManager, bool reuseReferenceManager, SyntaxAndDeclarationManager syntaxAndDeclarations, SemanticModelProvider? semanticModelProvider, AsyncQueue<CompilationEvent>? eventQueue = null)
: this(assemblyName, options, references, previousSubmission, submissionReturnType, hostObjectType, isSubmission, referenceManager, reuseReferenceManager, syntaxAndDeclarations, Compilation.SyntaxTreeCommonFeatures((IEnumerable<SyntaxTree>)((CommonSyntaxAndDeclarationManager)syntaxAndDeclarations).ExternalSyntaxTrees), semanticModelProvider, eventQueue)
{
}
private CSharpCompilation(string? assemblyName, CSharpCompilationOptions options, ImmutableArray<MetadataReference> references, CSharpCompilation? previousSubmission, Type? submissionReturnType, Type? hostObjectType, bool isSubmission, ReferenceManager? referenceManager, bool reuseReferenceManager, SyntaxAndDeclarationManager syntaxAndDeclarations, IReadOnlyDictionary<string, string> features, SemanticModelProvider? semanticModelProvider, AsyncQueue<CompilationEvent>? eventQueue = null)
: base(assemblyName, references, features, isSubmission, semanticModelProvider, eventQueue)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected O, but got Unknown
WellKnownMemberSignatureComparer = new WellKnownMembersSignatureComparer(this);
_options = options;
builtInOperators = new BuiltInOperators(this);
_scriptClass = new Lazy<ImplicitNamedTypeSymbol>(BindScriptClass);
_globalImports = new Lazy<ImmutableArray<NamespaceOrTypeAndUsingDirective>>(BindGlobalImports);
_usingsFromOptions = new Lazy<UsingsFromOptionsAndDiagnostics>(BindUsingsFromOptions);
_previousSubmissionImports = new Lazy<Imports>(ExpandPreviousSubmissionImports);
_globalNamespaceAlias = new Lazy<Microsoft.CodeAnalysis.CSharp.Symbols.AliasSymbol>(CreateGlobalNamespaceAlias);
_anonymousTypeManager = new AnonymousTypeManager(this);
LanguageVersion = CommonLanguageVersion(((CommonSyntaxAndDeclarationManager)syntaxAndDeclarations).ExternalSyntaxTrees);
if (isSubmission)
{
ScriptCompilationInfo = new CSharpScriptCompilationInfo(previousSubmission, submissionReturnType, hostObjectType);
}
if (reuseReferenceManager)
{
if (referenceManager == null)
{
throw new ArgumentNullException("referenceManager");
}
_referenceManager = referenceManager;
}
else
{
_referenceManager = new ReferenceManager(((Compilation)this).MakeSourceAssemblySimpleName(), ((CompilationOptions)Options).AssemblyIdentityComparer, ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)referenceManager)?.ObservedMetadata);
}
_syntaxAndDeclarations = syntaxAndDeclarations;
if (((Compilation)this).EventQueue != null)
{
((Compilation)this).EventQueue.TryEnqueue((CompilationEvent)new CompilationStartedEvent((Compilation)(object)this));
}
}
internal override void ValidateDebugEntryPoint(IMethodSymbol debugEntryPoint, DiagnosticBag diagnostics)
{
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol methodSymbol = (debugEntryPoint as Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.MethodSymbol)?.UnderlyingMethodSymbol;
if (methodSymbol?.DeclaringCompilation != this || !methodSymbol.IsDefinition)
{
diagnostics.Add(ErrorCode.ERR_DebugEntryPointNotSourceMethodDefinition, Location.None);
}
}
private static LanguageVersion CommonLanguageVersion(ImmutableArray<SyntaxTree> syntaxTrees)
{
LanguageVersion? languageVersion = null;
ImmutableArray<SyntaxTree>.Enumerator enumerator = syntaxTrees.GetEnumerator();
while (enumerator.MoveNext())
{
LanguageVersion languageVersion2 = ((CSharpParseOptions)(object)enumerator.Current.Options).LanguageVersion;
if (!languageVersion.HasValue)
{
languageVersion = languageVersion2;
}
else if (languageVersion != languageVersion2)
{
throw new ArgumentException(CodeAnalysisResources.InconsistentLanguageVersions, "syntaxTrees");
}
}
return languageVersion ?? LanguageVersion.Default.MapSpecifiedToEffectiveVersion();
}
public CSharpCompilation Clone()
{
return new CSharpCompilation(((Compilation)this).AssemblyName, _options, ((Compilation)this).ExternalReferences, PreviousSubmission, ((Compilation)this).SubmissionReturnType, ((Compilation)this).HostObjectType, ((Compilation)this).IsSubmission, _referenceManager, reuseReferenceManager: true, _syntaxAndDeclarations, ((Compilation)this).SemanticModelProvider);
}
private CSharpCompilation Update(ReferenceManager referenceManager, bool reuseReferenceManager, SyntaxAndDeclarationManager syntaxAndDeclarations)
{
return new CSharpCompilation(((Compilation)this).AssemblyName, _options, ((Compilation)this).ExternalReferences, PreviousSubmission, ((Compilation)this).SubmissionReturnType, ((Compilation)this).HostObjectType, ((Compilation)this).IsSubmission, referenceManager, reuseReferenceManager, syntaxAndDeclarations, ((Compilation)this).SemanticModelProvider);
}
public CSharpCompilation WithAssemblyName(string? assemblyName)
{
return new CSharpCompilation(assemblyName, _options, ((Compilation)this).ExternalReferences, PreviousSubmission, ((Compilation)this).SubmissionReturnType, ((Compilation)this).HostObjectType, ((Compilation)this).IsSubmission, _referenceManager, assemblyName == ((Compilation)this).AssemblyName, _syntaxAndDeclarations, ((Compilation)this).SemanticModelProvider);
}
public CSharpCompilation WithReferences(IEnumerable<MetadataReference>? references)
{
return new CSharpCompilation(((Compilation)this).AssemblyName, _options, Compilation.ValidateReferences<CSharpCompilationReference>(references), PreviousSubmission, ((Compilation)this).SubmissionReturnType, ((Compilation)this).HostObjectType, ((Compilation)this).IsSubmission, null, reuseReferenceManager: false, _syntaxAndDeclarations, ((Compilation)this).SemanticModelProvider);
}
public CSharpCompilation WithReferences(params MetadataReference[] references)
{
return WithReferences((IEnumerable<MetadataReference>?)references);
}
public CSharpCompilation WithOptions(CSharpCompilationOptions options)
{
CSharpCompilationOptions options2 = Options;
bool reuseReferenceManager = ((CompilationOptions)options2).CanReuseCompilationReferenceManager((CompilationOptions)(object)options);
bool flag = ((CompilationOptions)options2).ScriptClassName == ((CompilationOptions)options).ScriptClassName && ((CompilationOptions)options2).SourceReferenceResolver == ((CompilationOptions)options).SourceReferenceResolver;
return new CSharpCompilation(((Compilation)this).AssemblyName, options, ((Compilation)this).ExternalReferences, PreviousSubmission, ((Compilation)this).SubmissionReturnType, ((Compilation)this).HostObjectType, ((Compilation)this).IsSubmission, _referenceManager, reuseReferenceManager, flag ? _syntaxAndDeclarations : new SyntaxAndDeclarationManager(((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).ExternalSyntaxTrees, ((CompilationOptions)options).ScriptClassName, ((CompilationOptions)options).SourceReferenceResolver, ((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).MessageProvider, ((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).IsSubmission, null), ((Compilation)this).SemanticModelProvider);
}
public CSharpCompilation WithScriptCompilationInfo(CSharpScriptCompilationInfo? info)
{
if (info == ScriptCompilationInfo)
{
return this;
}
bool reuseReferenceManager = ScriptCompilationInfo?.PreviousScriptCompilation == info?.PreviousScriptCompilation;
return new CSharpCompilation(((Compilation)this).AssemblyName, _options, ((Compilation)this).ExternalReferences, info?.PreviousScriptCompilation, (info != null) ? ((ScriptCompilationInfo)info).ReturnTypeOpt : null, (info != null) ? ((ScriptCompilationInfo)info).GlobalsType : null, info != null, _referenceManager, reuseReferenceManager, _syntaxAndDeclarations, ((Compilation)this).SemanticModelProvider);
}
internal override Compilation WithSemanticModelProvider(SemanticModelProvider? semanticModelProvider)
{
if (((Compilation)this).SemanticModelProvider == semanticModelProvider)
{
return (Compilation)(object)this;
}
return (Compilation)(object)new CSharpCompilation(((Compilation)this).AssemblyName, _options, ((Compilation)this).ExternalReferences, PreviousSubmission, ((Compilation)this).SubmissionReturnType, ((Compilation)this).HostObjectType, ((Compilation)this).IsSubmission, _referenceManager, reuseReferenceManager: true, _syntaxAndDeclarations, semanticModelProvider);
}
internal override Compilation WithEventQueue(AsyncQueue<CompilationEvent>? eventQueue)
{
return (Compilation)(object)new CSharpCompilation(((Compilation)this).AssemblyName, _options, ((Compilation)this).ExternalReferences, PreviousSubmission, ((Compilation)this).SubmissionReturnType, ((Compilation)this).HostObjectType, ((Compilation)this).IsSubmission, _referenceManager, reuseReferenceManager: true, _syntaxAndDeclarations, ((Compilation)this).SemanticModelProvider, eventQueue);
}
internal override bool HasSubmissionResult()
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Invalid comparison between Unknown and I4
SyntaxTree val = ((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).ExternalSyntaxTrees.SingleOrDefault();
if (val == null)
{
return false;
}
CompilationUnitSyntax compilationUnitRoot = val.GetCompilationUnitRoot();
if (((SyntaxNode)compilationUnitRoot).HasErrors)
{
return false;
}
if (((SyntaxNode)compilationUnitRoot).DescendantNodes((Func<SyntaxNode, bool>)((SyntaxNode n) => n is GlobalStatementSyntax || n is StatementSyntax || n is CompilationUnitSyntax), false).Any((SyntaxNode n) => n.IsKind(SyntaxKind.ReturnStatement)))
{
return true;
}
GlobalStatementSyntax globalStatementSyntax = (GlobalStatementSyntax)((IEnumerable<MemberDeclarationSyntax>)(object)compilationUnitRoot.Members).LastOrDefault((MemberDeclarationSyntax m) => ((SyntaxNode?)(object)m).IsKind(SyntaxKind.GlobalStatement));
if (globalStatementSyntax != null)
{
StatementSyntax statement = globalStatementSyntax.Statement;
if (((SyntaxNode?)(object)statement).IsKind(SyntaxKind.ExpressionStatement))
{
ExpressionStatementSyntax expressionStatementSyntax = (ExpressionStatementSyntax)statement;
SyntaxToken semicolonToken = expressionStatementSyntax.SemicolonToken;
if (((SyntaxToken)(ref semicolonToken)).IsMissing)
{
SemanticModel semanticModel = ((Compilation)this).GetSemanticModel(val, false);
ExpressionSyntax expression = expressionStatementSyntax.Expression;
TypeInfo typeInfo = semanticModel.GetTypeInfo((SyntaxNode)(object)expression, default(CancellationToken));
ITypeSymbol convertedType = ((TypeInfo)(ref typeInfo)).ConvertedType;
if (convertedType == null)
{
return true;
}
return (int)convertedType.SpecialType != 6;
}
}
}
return false;
}
public bool ContainsSyntaxTree(SyntaxTree? syntaxTree)
{
if (syntaxTree != null)
{
return _syntaxAndDeclarations.GetLazyState().RootNamespaces.ContainsKey(syntaxTree);
}
return false;
}
public CSharpCompilation AddSyntaxTrees(params SyntaxTree[] trees)
{
return AddSyntaxTrees((IEnumerable<SyntaxTree>)trees);
}
public CSharpCompilation AddSyntaxTrees(IEnumerable<SyntaxTree> trees)
{
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
if (trees == null)
{
throw new ArgumentNullException("trees");
}
if (EnumerableExtensions.IsEmpty<SyntaxTree>(trees))
{
return this;
}
PooledHashSet<SyntaxTree> instance = PooledHashSet<SyntaxTree>.GetInstance();
SyntaxAndDeclarationManager syntaxAndDeclarations = _syntaxAndDeclarations;
ISetExtensions.AddAll<SyntaxTree>((ISet<SyntaxTree>)instance, ((CommonSyntaxAndDeclarationManager)syntaxAndDeclarations).ExternalSyntaxTrees);
bool flag = true;
int num = 0;
foreach (CSharpSyntaxTree item in trees.Cast<CSharpSyntaxTree>())
{
if (item == null)
{
throw new ArgumentNullException(string.Format("{0}[{1}]", "trees", num));
}
if (!((SyntaxTree)item).HasCompilationUnitRoot)
{
throw new ArgumentException(CSharpResources.TreeMustHaveARootNodeWith, string.Format("{0}[{1}]", "trees", num));
}
if (((HashSet<SyntaxTree>)(object)instance).Contains((SyntaxTree)(object)item))
{
throw new ArgumentException(CSharpResources.SyntaxTreeAlreadyPresent, string.Format("{0}[{1}]", "trees", num));
}
if (((Compilation)this).IsSubmission && (int)((ParseOptions)item.Options).Kind == 0)
{
throw new ArgumentException(CSharpResources.SubmissionCanOnlyInclude, string.Format("{0}[{1}]", "trees", num));
}
((HashSet<SyntaxTree>)(object)instance).Add((SyntaxTree)(object)item);
flag &= !item.HasReferenceOrLoadDirectives;
num++;
}
instance.Free();
if (((Compilation)this).IsSubmission && num > 1)
{
throw new ArgumentException(CSharpResources.SubmissionCanHaveAtMostOne, "trees");
}
syntaxAndDeclarations = syntaxAndDeclarations.AddSyntaxTrees(trees);
return Update(_referenceManager, flag, syntaxAndDeclarations);
}
public CSharpCompilation RemoveSyntaxTrees(params SyntaxTree[] trees)
{
return RemoveSyntaxTrees((IEnumerable<SyntaxTree>)trees);
}
public CSharpCompilation RemoveSyntaxTrees(IEnumerable<SyntaxTree> trees)
{
if (trees == null)
{
throw new ArgumentNullException("trees");
}
if (EnumerableExtensions.IsEmpty<SyntaxTree>(trees))
{
return this;
}
PooledHashSet<SyntaxTree> instance = PooledHashSet<SyntaxTree>.GetInstance();
PooledHashSet<SyntaxTree> instance2 = PooledHashSet<SyntaxTree>.GetInstance();
SyntaxAndDeclarationManager syntaxAndDeclarations = _syntaxAndDeclarations;
ISetExtensions.AddAll<SyntaxTree>((ISet<SyntaxTree>)instance2, ((CommonSyntaxAndDeclarationManager)syntaxAndDeclarations).ExternalSyntaxTrees);
bool flag = true;
int num = 0;
foreach (CSharpSyntaxTree item in trees.Cast<CSharpSyntaxTree>())
{
if (!((HashSet<SyntaxTree>)(object)instance2).Contains((SyntaxTree)(object)item))
{
ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap = syntaxAndDeclarations.GetLazyState().LoadedSyntaxTreeMap;
if (SyntaxAndDeclarationManager.IsLoadedSyntaxTree((SyntaxTree)(object)item, loadedSyntaxTreeMap))
{
throw new ArgumentException(CSharpResources.SyntaxTreeFromLoadNoRemoveReplace, string.Format("{0}[{1}]", "trees", num));
}
throw new ArgumentException(CSharpResources.SyntaxTreeNotFoundToRemove, string.Format("{0}[{1}]", "trees", num));
}
((HashSet<SyntaxTree>)(object)instance).Add((SyntaxTree)(object)item);
flag &= !item.HasReferenceOrLoadDirectives;
num++;
}
instance2.Free();
syntaxAndDeclarations = syntaxAndDeclarations.RemoveSyntaxTrees((HashSet<SyntaxTree>)(object)instance);
instance.Free();
return Update(_referenceManager, flag, syntaxAndDeclarations);
}
public CSharpCompilation RemoveAllSyntaxTrees()
{
SyntaxAndDeclarationManager syntaxAndDeclarations = _syntaxAndDeclarations;
return Update(_referenceManager, !syntaxAndDeclarations.MayHaveReferenceDirectives(), syntaxAndDeclarations.WithExternalSyntaxTrees(ImmutableArray<SyntaxTree>.Empty));
}
public CSharpCompilation ReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree? newTree)
{
oldTree = (SyntaxTree)(object)(CSharpSyntaxTree)(object)oldTree;
newTree = (SyntaxTree?)(object)(CSharpSyntaxTree)(object)newTree;
if (oldTree == null)
{
throw new ArgumentNullException("oldTree");
}
if (newTree == null)
{
return RemoveSyntaxTrees(oldTree);
}
if (newTree == oldTree)
{
return this;
}
if (!newTree.HasCompilationUnitRoot)
{
throw new ArgumentException(CSharpResources.TreeMustHaveARootNodeWith, "newTree");
}
SyntaxAndDeclarationManager syntaxAndDeclarations = _syntaxAndDeclarations;
ImmutableArray<SyntaxTree> externalSyntaxTrees = ((CommonSyntaxAndDeclarationManager)syntaxAndDeclarations).ExternalSyntaxTrees;
if (!externalSyntaxTrees.Contains(oldTree))
{
ImmutableDictionary<string, SyntaxTree> loadedSyntaxTreeMap = syntaxAndDeclarations.GetLazyState().LoadedSyntaxTreeMap;
if (SyntaxAndDeclarationManager.IsLoadedSyntaxTree(oldTree, loadedSyntaxTreeMap))
{
throw new ArgumentException(CSharpResources.SyntaxTreeFromLoadNoRemoveReplace, "oldTree");
}
throw new ArgumentException(CSharpResources.SyntaxTreeNotFoundToRemove, "oldTree");
}
if (externalSyntaxTrees.Contains(newTree))
{
throw new ArgumentException(CSharpResources.SyntaxTreeAlreadyPresent, "newTree");
}
bool reuseReferenceManager = !oldTree.HasReferenceOrLoadDirectives() && !newTree.HasReferenceOrLoadDirectives();
syntaxAndDeclarations = syntaxAndDeclarations.ReplaceSyntaxTree(oldTree, newTree);
return Update(_referenceManager, reuseReferenceManager, syntaxAndDeclarations);
}
internal override int GetSyntaxTreeOrdinal(SyntaxTree tree)
{
try
{
return _syntaxAndDeclarations.GetLazyState().OrdinalMap[tree];
}
catch (KeyNotFoundException)
{
throw new KeyNotFoundException("Syntax tree not found with file path: " + tree.FilePath);
}
}
internal OneOrMany<SyntaxTree> GetSyntaxTreesByMappedPath(string mappedPath)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> mappedPathToSyntaxTree = _mappedPathToSyntaxTree;
if (mappedPathToSyntaxTree.IsDefault)
{
RoslynImmutableInterlocked.InterlockedInitialize<string, OneOrMany<SyntaxTree>>(ref _mappedPathToSyntaxTree, computeMappedPathToSyntaxTree());
mappedPathToSyntaxTree = _mappedPathToSyntaxTree;
}
OneOrMany<SyntaxTree> result = default(OneOrMany<SyntaxTree>);
if (!mappedPathToSyntaxTree.TryGetValue(mappedPath, ref result))
{
return OneOrMany<SyntaxTree>.Empty;
}
return result;
ImmutableSegmentedDictionary<string, OneOrMany<SyntaxTree>> computeMappedPathToSyntaxTree()
{
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
Builder<string, OneOrMany<SyntaxTree>> val = ImmutableSegmentedDictionary.CreateBuilder<string, OneOrMany<SyntaxTree>>();
SourceReferenceResolver sourceReferenceResolver = ((CompilationOptions)Options).SourceReferenceResolver;
ImmutableArray<SyntaxTree>.Enumerator enumerator = SyntaxTrees.GetEnumerator();
while (enumerator.MoveNext())
{
SyntaxTree current = enumerator.Current;
string text = ((sourceReferenceResolver != null) ? sourceReferenceResolver.NormalizePath(current.FilePath, (string)null) : null) ?? current.FilePath;
val[text] = (val.ContainsKey(text) ? val[text].Add(current) : OneOrMany.Create<SyntaxTree>(current));
}
return val.ToImmutable();
}
}
internal override CommonReferenceManager CommonGetBoundReferenceManager()
{
return (CommonReferenceManager)(object)GetBoundReferenceManager();
}
internal ReferenceManager GetBoundReferenceManager()
{
if ((object)_lazyAssemblySymbol == null)
{
_referenceManager.CreateSourceAssemblyForCompilation(this);
}
return _referenceManager;
}
internal bool ReferenceManagerEquals(CSharpCompilation other)
{
return _referenceManager == other._referenceManager;
}
internal Symbol? GetAssemblyOrModuleSymbol(MetadataReference reference)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if (reference == null)
{
throw new ArgumentNullException("reference");
}
MetadataReferenceProperties properties = reference.Properties;
if ((int)((MetadataReferenceProperties)(ref properties)).Kind == 0)
{
return ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).GetReferencedAssemblySymbol(reference);
}
int referencedModuleIndex = ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).GetReferencedModuleIndex(reference);
if (referencedModuleIndex >= 0)
{
return Assembly.Modules[referencedModuleIndex];
}
return null;
}
internal override TSymbol? GetSymbolInternal<TSymbol>(ISymbol? symbol)
{
return (TSymbol)(object)symbol.GetSymbol<Symbol>();
}
public MetadataReference? GetDirectiveReference(ReferenceDirectiveTriviaSyntax directive)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
IDictionary<ValueTuple<string, string>, MetadataReference> referenceDirectiveMap = ((Compilation)this).ReferenceDirectiveMap;
string filePath = directive.SyntaxTree.FilePath;
SyntaxToken file = directive.File;
if (!referenceDirectiveMap.TryGetValue((filePath, ((SyntaxToken)(ref file)).ValueText), out var value))
{
return null;
}
return value;
}
public CSharpCompilation AddReferences(params MetadataReference[] references)
{
return (CSharpCompilation)(object)((Compilation)this).AddReferences(references);
}
public CSharpCompilation AddReferences(IEnumerable<MetadataReference> references)
{
return (CSharpCompilation)(object)((Compilation)this).AddReferences(references);
}
public CSharpCompilation RemoveReferences(params MetadataReference[] references)
{
return (CSharpCompilation)(object)((Compilation)this).RemoveReferences(references);
}
public CSharpCompilation RemoveReferences(IEnumerable<MetadataReference> references)
{
return (CSharpCompilation)(object)((Compilation)this).RemoveReferences(references);
}
public CSharpCompilation RemoveAllReferences()
{
return (CSharpCompilation)(object)((Compilation)this).RemoveAllReferences();
}
public CSharpCompilation ReplaceReference(MetadataReference oldReference, MetadataReference newReference)
{
return (CSharpCompilation)(object)((Compilation)this).ReplaceReference(oldReference, newReference);
}
public override CompilationReference ToMetadataReference(ImmutableArray<string> aliases = default(ImmutableArray<string>), bool embedInteropTypes = false)
{
return (CompilationReference)(object)new CSharpCompilationReference(this, aliases, embedInteropTypes);
}
private void GetAllUnaliasedModules(ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> modules)
{
modules.AddRange(Assembly.Modules);
ReferenceManager boundReferenceManager = GetBoundReferenceManager();
for (int i = 0; i < ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).ReferencedAssemblies.Length; i++)
{
if (((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).DeclarationsAccessibleWithoutAlias(i))
{
modules.AddRange(((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).ReferencedAssemblies[i].Modules);
}
}
}
internal void GetUnaliasedReferencedAssemblies(ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> assemblies)
{
ReferenceManager boundReferenceManager = GetBoundReferenceManager();
int length = ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).ReferencedAssemblies.Length;
assemblies.EnsureCapacity(assemblies.Count + length);
for (int i = 0; i < length; i++)
{
if (((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).DeclarationsAccessibleWithoutAlias(i))
{
assemblies.Add(((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).ReferencedAssemblies[i]);
}
}
}
public MetadataReference? GetMetadataReference(IAssemblySymbol assemblySymbol)
{
return ((Compilation)this).GetMetadataReference(assemblySymbol);
}
private protected override MetadataReference? CommonGetMetadataReference(IAssemblySymbol assemblySymbol)
{
if (assemblySymbol is Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.AssemblySymbol { UnderlyingAssemblySymbol: var underlyingAssemblySymbol })
{
return GetMetadataReference(underlyingAssemblySymbol);
}
return null;
}
internal MetadataReference? GetMetadataReference(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol? assemblySymbol)
{
return ((CommonReferenceManager)GetBoundReferenceManager()).GetMetadataReference((IAssemblySymbolInternal)(object)assemblySymbol);
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol? GetCompilationNamespace(INamespaceSymbol namespaceSymbol)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
if (namespaceSymbol is Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.NamespaceSymbol namespaceSymbol2 && (int)namespaceSymbol.NamespaceKind == 3 && (object)namespaceSymbol.ContainingCompilation == this)
{
return namespaceSymbol2.UnderlyingNamespaceSymbol;
}
INamespaceSymbol containingNamespace = ((ISymbol)namespaceSymbol).ContainingNamespace;
if (containingNamespace == null)
{
return GlobalNamespace;
}
return GetCompilationNamespace(containingNamespace)?.GetNestedNamespace(((ISymbol)namespaceSymbol).Name);
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol? GetCompilationNamespace(Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol namespaceSymbol)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)namespaceSymbol.NamespaceKind == 3 && namespaceSymbol.ContainingCompilation == this)
{
return namespaceSymbol;
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol containingNamespace = namespaceSymbol.ContainingNamespace;
if (containingNamespace == null)
{
return GlobalNamespace;
}
return GetCompilationNamespace(containingNamespace)?.GetNestedNamespace(namespaceSymbol.Name);
}
internal bool GetExternAliasTarget(string aliasName, out Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol @namespace)
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol value;
if (_externAliasTargets == null)
{
Interlocked.CompareExchange(ref _externAliasTargets, new ConcurrentDictionary<string, Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>(), null);
}
else if (_externAliasTargets.TryGetValue(aliasName, out value))
{
@namespace = value;
return !(@namespace is MissingNamespaceSymbol);
}
ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol> val = null;
ReferenceManager boundReferenceManager = GetBoundReferenceManager();
for (int i = 0; i < ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).ReferencedAssemblies.Length; i++)
{
if (((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).AliasesOfReferencedAssemblies[i].Contains(aliasName))
{
val = val ?? ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>.GetInstance();
val.Add(((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)boundReferenceManager).ReferencedAssemblies[i].GlobalNamespace);
}
}
bool flag = val != null;
@namespace = (flag ? MergedNamespaceSymbol.Create(new NamespaceExtent(this), null, val.ToImmutableAndFree()) : new MissingNamespaceSymbol(new MissingModuleSymbol(new MissingAssemblySymbol(new AssemblyIdentity(Guid.NewGuid().ToString(), (Version)null, (string)null, default(ImmutableArray<byte>), false, false, AssemblyContentType.Default)), -1)));
@namespace = _externAliasTargets.GetOrAdd(aliasName, @namespace);
return flag;
}
private ImplicitNamedTypeSymbol? BindScriptClass()
{
return (ImplicitNamedTypeSymbol)((Compilation)this).CommonBindScriptClass().GetSymbol();
}
internal bool IsSubmissionSyntaxTree(SyntaxTree tree)
{
if (((Compilation)this).IsSubmission)
{
return tree == ((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).ExternalSyntaxTrees.SingleOrDefault();
}
return false;
}
private ImmutableArray<NamespaceOrTypeAndUsingDirective> BindGlobalImports()
{
UsingsFromOptionsAndDiagnostics usingsFromOptions = UsingsFromOptions;
CSharpCompilation previousSubmission = PreviousSubmission;
ImmutableArray<NamespaceOrTypeAndUsingDirective> result = ((previousSubmission != null) ? Imports.ExpandPreviousSubmissionImports(previousSubmission.GlobalImports, this) : ImmutableArray<NamespaceOrTypeAndUsingDirective>.Empty);
if (usingsFromOptions.UsingNamespacesOrTypes.IsEmpty)
{
return result;
}
if (result.IsEmpty)
{
return usingsFromOptions.UsingNamespacesOrTypes;
}
ArrayBuilder<NamespaceOrTypeAndUsingDirective> instance = ArrayBuilder<NamespaceOrTypeAndUsingDirective>.GetInstance();
PooledHashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol> instance2 = PooledHashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>.GetInstance();
instance.AddRange(usingsFromOptions.UsingNamespacesOrTypes);
ISetExtensions.AddAll<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>((ISet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>)instance2, usingsFromOptions.UsingNamespacesOrTypes.Select((NamespaceOrTypeAndUsingDirective unt) => unt.NamespaceOrType));
ImmutableArray<NamespaceOrTypeAndUsingDirective>.Enumerator enumerator = result.GetEnumerator();
while (enumerator.MoveNext())
{
NamespaceOrTypeAndUsingDirective current = enumerator.Current;
if (((HashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol>)(object)instance2).Add(current.NamespaceOrType))
{
instance.Add(current);
}
}
instance2.Free();
return instance.ToImmutableAndFree();
}
private UsingsFromOptionsAndDiagnostics BindUsingsFromOptions()
{
return UsingsFromOptionsAndDiagnostics.FromOptions(this);
}
internal Imports GetSubmissionImports()
{
SyntaxTree val = ((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).ExternalSyntaxTrees.SingleOrDefault();
if (val == null)
{
return Imports.Empty;
}
return ((SourceNamespaceSymbol)SourceModule.GlobalNamespace).GetImports((CSharpSyntaxNode)(object)val.GetRoot(default(CancellationToken)), null);
}
internal Imports GetPreviousSubmissionImports()
{
return _previousSubmissionImports.Value;
}
private Imports ExpandPreviousSubmissionImports()
{
CSharpCompilation previousSubmission = PreviousSubmission;
if (previousSubmission == null)
{
return Imports.Empty;
}
return Imports.ExpandPreviousSubmissionImports(previousSubmission.GetPreviousSubmissionImports(), this).Concat(Imports.ExpandPreviousSubmissionImports(previousSubmission.GetSubmissionImports(), this));
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol GetSpecialType(SpecialType specialType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected I4, but got Unknown
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if ((int)specialType <= 0 || (int)specialType > 46)
{
throw new ArgumentOutOfRangeException("specialType", $"Unexpected SpecialType: '{(int)specialType}'.");
}
if (((Compilation)this).IsTypeMissing(specialType))
{
MetadataTypeName fullName = MetadataTypeName.FromFullName(SpecialTypes.GetMetadataName(specialType), true, -1);
return new MissingMetadataTypeSymbol.TopLevel(Assembly.CorLibrary.Modules[0], ref fullName, specialType);
}
return Assembly.GetSpecialType(specialType);
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol GetOrCreateNullableType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol typeArgument)
{
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol = default(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol);
if (!_typeToNullableVersion.TryGetValue(typeArgument, ref namedTypeSymbol))
{
namedTypeSymbol = GetSpecialType((SpecialType)32).Construct(typeArgument);
_typeToNullableVersion.TryAdd(typeArgument, namedTypeSymbol);
}
return namedTypeSymbol;
}
internal Symbol GetSpecialTypeMember(SpecialMember specialMember)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return Assembly.GetSpecialTypeMember(specialMember);
}
internal override ISymbolInternal CommonGetSpecialTypeMember(SpecialMember specialMember)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return (ISymbolInternal)(object)GetSpecialTypeMember(specialMember);
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol GetTypeByReflectionType(Type type, BindingDiagnosticBag diagnostics)
{
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol typeSymbol = Assembly.GetTypeByReflectionType(type);
if ((object)typeSymbol == null)
{
ExtendedErrorTypeSymbol extendedErrorTypeSymbol = new ExtendedErrorTypeSymbol(this, type.Name, 0, (DiagnosticInfo?)(object)CreateReflectionTypeNotFoundError(type));
diagnostics.Add(extendedErrorTypeSymbol.ErrorInfo, NoLocation.Singleton);
typeSymbol = extendedErrorTypeSymbol;
}
return typeSymbol;
}
private static CSDiagnosticInfo CreateReflectionTypeNotFoundError(Type type)
{
return new CSDiagnosticInfo(ErrorCode.ERR_GlobalSingleTypeNameNotFound, new object[1] { type.AssemblyQualifiedName ?? "" }, ImmutableArray<Symbol>.Empty, ImmutableArray<Location>.Empty);
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol? GetHostObjectTypeSymbol()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
if (((Compilation)this).HostObjectType != null && (object)_lazyHostObjectTypeSymbol == null)
{
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol typeSymbol = Assembly.GetTypeByReflectionType(((Compilation)this).HostObjectType);
if ((object)typeSymbol == null)
{
MetadataTypeName fullName = MetadataTypeName.FromNamespaceAndTypeName(((Compilation)this).HostObjectType.Namespace ?? string.Empty, ((Compilation)this).HostObjectType.Name, true, -1);
typeSymbol = new MissingMetadataTypeSymbol.TopLevel(new MissingAssemblySymbol(AssemblyIdentity.FromAssemblyDefinition(((Compilation)this).HostObjectType.GetTypeInfo().Assembly)).Modules[0], ref fullName, (SpecialType)0, (DiagnosticInfo?)(object)CreateReflectionTypeNotFoundError(((Compilation)this).HostObjectType));
}
Interlocked.CompareExchange(ref _lazyHostObjectTypeSymbol, typeSymbol, null);
}
return _lazyHostObjectTypeSymbol;
}
internal SynthesizedInteractiveInitializerMethod? GetSubmissionInitializer()
{
if (!((Compilation)this).IsSubmission || (object)ScriptClass == null)
{
return null;
}
return ScriptClass.GetScriptInitializer();
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol? GetTypeByMetadataName(string fullyQualifiedMetadataName)
{
(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol) conflicts;
return Assembly.GetTypeByMetadataName(fullyQualifiedMetadataName, includeReferences: true, isWellKnownType: false, out conflicts);
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol? GetEntryPoint(CancellationToken cancellationToken)
{
return GetEntryPointAndDiagnostics(cancellationToken).MethodSymbol;
}
internal EntryPoint GetEntryPointAndDiagnostics(CancellationToken cancellationToken)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
if (_lazyEntryPoint == null)
{
SynthesizedSimpleProgramEntryPointSymbol simpleProgramEntryPoint = SynthesizedSimpleProgramEntryPointSymbol.GetSimpleProgramEntryPoint(this);
EntryPoint entryPoint;
if (!EnumBounds.IsApplication(((CompilationOptions)Options).OutputKind) && (object)ScriptClass == null)
{
if ((object)simpleProgramEntryPoint != null)
{
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance();
instance.Add(ErrorCode.ERR_SimpleProgramNotAnExecutable, simpleProgramEntryPoint.ReturnTypeSyntax.Location);
entryPoint = new EntryPoint(null, ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).ToReadOnlyAndFree());
}
else
{
entryPoint = EntryPoint.None;
}
}
else
{
entryPoint = null;
if (((CompilationOptions)Options).MainTypeName != null && !StringExtensions.IsValidClrTypeName(((CompilationOptions)Options).MainTypeName))
{
entryPoint = EntryPoint.None;
}
if (entryPoint == null)
{
entryPoint = new EntryPoint(FindEntryPoint(simpleProgramEntryPoint, cancellationToken, out ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> sealedDiagnostics), sealedDiagnostics);
}
if (((CompilationOptions)Options).MainTypeName != null && (object)simpleProgramEntryPoint != null)
{
DiagnosticBag instance2 = DiagnosticBag.GetInstance();
instance2.Add(ErrorCode.ERR_SimpleProgramDisallowsMainType, NoLocation.Singleton);
entryPoint = new EntryPoint(entryPoint.MethodSymbol, new ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(ImmutableArrayExtensions.Concat<Diagnostic>(entryPoint.Diagnostics.Diagnostics, instance2.ToReadOnlyAndFree()), entryPoint.Diagnostics.Dependencies));
}
}
Interlocked.CompareExchange(ref _lazyEntryPoint, entryPoint, null);
}
return _lazyEntryPoint;
}
private Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol? FindEntryPoint(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol? simpleProgramEntryPointSymbol, CancellationToken cancellationToken, out ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> sealedDiagnostics)
{
//IL_055c: Unknown result type (might be due to invalid IL or missing references)
//IL_0561: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Invalid comparison between Unknown and I4
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Invalid comparison between Unknown and I4
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_0477: Unknown result type (might be due to invalid IL or missing references)
//IL_047c: Unknown result type (might be due to invalid IL or missing references)
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance();
ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol> instance2 = ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>.GetInstance();
try
{
string mainTypeName = ((CompilationOptions)Options).MainTypeName;
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol globalNamespace = SourceModule.GlobalNamespace;
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol scriptClass = ScriptClass;
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol;
Enumerator<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol> enumerator;
if (mainTypeName != null)
{
if ((object)scriptClass != null)
{
instance.Add(ErrorCode.WRN_MainIgnored, NoLocation.Singleton, mainTypeName);
return scriptClass.GetScriptEntryPoint();
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceOrTypeSymbol namespaceOrTypeSymbol = globalNamespace.GetNamespaceOrTypeByQualifiedName(mainTypeName.Split(new char[1] { '.' })).OfMinimalArity();
if ((object)namespaceOrTypeSymbol == null)
{
instance.Add(ErrorCode.ERR_MainClassNotFound, NoLocation.Singleton, mainTypeName);
return null;
}
namedTypeSymbol = namespaceOrTypeSymbol as Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol;
if ((object)namedTypeSymbol == null || namedTypeSymbol.IsGenericType || ((int)namedTypeSymbol.TypeKind != 2 && (int)namedTypeSymbol.TypeKind != 10 && !namedTypeSymbol.IsInterface))
{
instance.Add(ErrorCode.ERR_MainClassNotClass, namespaceOrTypeSymbol.GetFirstLocation(), namespaceOrTypeSymbol);
return null;
}
AddEntryPointCandidates(instance2, namedTypeSymbol.GetMembersUnordered());
}
else
{
namedTypeSymbol = null;
AddEntryPointCandidates(instance2, GetSymbolsWithNameCore("Main", (SymbolFilter)4, cancellationToken));
if ((object)scriptClass != null || (object)simpleProgramEntryPointSymbol != null)
{
enumerator = instance2.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol current = enumerator.Current;
if (!(current is SynthesizedSimpleProgramEntryPointSymbol))
{
instance.Add(ErrorCode.WRN_MainIgnored, current.GetFirstLocation(), current);
}
}
if ((object)scriptClass != null)
{
return scriptClass.GetScriptEntryPoint();
}
instance2.Clear();
instance2.Add(simpleProgramEntryPointSymbol);
}
}
ArrayBuilder<(bool, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, BindingDiagnosticBag)> instance3 = ArrayBuilder<(bool, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, BindingDiagnosticBag)>.GetInstance();
BindingDiagnosticBag noMainFoundDiagnostics = BindingDiagnosticBag.GetInstance(instance);
ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol> instance4 = ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>.GetInstance();
enumerator = instance2.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol current2 = enumerator.Current;
BindingDiagnosticBag instance5 = BindingDiagnosticBag.GetInstance(instance);
(bool IsCandidate, bool IsTaskLike) tuple = HasEntryPointSignature(current2, instance5);
var (flag, _) = tuple;
if (tuple.IsTaskLike)
{
instance3.Add((flag, current2, instance5));
continue;
}
if (checkValid(current2, flag, instance5))
{
if (current2.IsAsync)
{
instance.Add(ErrorCode.ERR_NonTaskMainCantBeAsync, current2.GetFirstLocation());
}
else
{
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).AddRange((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance5, false);
instance4.Add(current2);
}
}
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance5).Free();
}
Enumerator<(bool, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, BindingDiagnosticBag)> enumerator2;
if (instance4.Count == 0)
{
enumerator2 = instance3.GetEnumerator();
while (enumerator2.MoveNext())
{
var (isCandidate, methodSymbol, bindingDiagnosticBag) = enumerator2.Current;
if (checkValid(methodSymbol, isCandidate, bindingDiagnosticBag) && Binder.CheckFeatureAvailability((SyntaxNode)(object)methodSymbol.ExtractReturnTypeSyntax(), MessageID.IDS_FeatureAsyncMain, instance))
{
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).AddRange((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)bindingDiagnosticBag, false);
instance4.Add(methodSymbol);
}
}
}
else if (LanguageVersion >= MessageID.IDS_FeatureAsyncMain.RequiredVersion() && instance3.Count > 0)
{
ImmutableArray<Symbol> immutableArray = ArrayBuilderExtensions.SelectAsArray<(bool, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, BindingDiagnosticBag), Symbol>(instance3, (Func<(bool, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, BindingDiagnosticBag), Symbol>)(((bool IsValid, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol Candidate, BindingDiagnosticBag SpecificDiagnostics) s) => s.Candidate));
ImmutableArray<Location> additionalLocations = ImmutableArrayExtensions.SelectAsArray<Symbol, Location>(immutableArray, (Func<Symbol, Location>)((Symbol s) => s.GetFirstLocation()));
ImmutableArray<Symbol>.Enumerator enumerator3 = immutableArray.GetEnumerator();
while (enumerator3.MoveNext())
{
Symbol current3 = enumerator3.Current;
CSDiagnosticInfo info = new CSDiagnosticInfo(ErrorCode.WRN_SyncAndAsyncEntryPoints, new object[2]
{
current3,
instance4[0]
}, immutableArray, additionalLocations);
((BindingDiagnosticBag)instance).Add((Diagnostic)(object)new CSDiagnostic((DiagnosticInfo)(object)info, current3.GetFirstLocation()));
}
}
enumerator2 = instance3.GetEnumerator();
while (enumerator2.MoveNext())
{
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)enumerator2.Current.Item3).Free();
}
if (instance4.Count == 0)
{
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).AddRange((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)noMainFoundDiagnostics, false);
}
else if ((object)namedTypeSymbol == null)
{
foreach (Diagnostic item in ((BindingDiagnosticBag)noMainFoundDiagnostics).DiagnosticBag.AsEnumerable())
{
if (item.Code == 28 || item.Code == 402)
{
((BindingDiagnosticBag)instance).Add(item);
}
}
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).AddDependencies((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)noMainFoundDiagnostics, false);
}
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol result = null;
if (instance4.Count == 0)
{
if ((object)namedTypeSymbol == null)
{
instance.Add(ErrorCode.ERR_NoEntryPoint, NoLocation.Singleton);
}
else
{
instance.Add(ErrorCode.ERR_NoMainInClass, namedTypeSymbol.GetFirstLocation(), namedTypeSymbol);
}
}
else
{
enumerator = instance4.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol current5 = enumerator.Current;
if (current5.GetUnmanagedCallersOnlyAttributeData(forceComplete: true) != null)
{
instance.Add(ErrorCode.ERR_EntryPointCannotBeUnmanagedCallersOnly, current5.GetFirstLocation());
}
}
if (instance4.Count > 1)
{
instance4.Sort((IComparer<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>)LexicalOrderSymbolComparer.Instance);
CSDiagnosticInfo info2 = new CSDiagnosticInfo(ErrorCode.ERR_MultipleEntryPoints, Array.Empty<object>(), ImmutableArrayExtensions.AsImmutable<Symbol>(((IEnumerable)instance4).OfType<Symbol>()), ImmutableArrayExtensions.AsImmutable<Location>(((IEnumerable<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>)instance4).Select((Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol m) => m.GetFirstLocation()).OfType<Location>()));
((BindingDiagnosticBag)instance).Add((Diagnostic)(object)new CSDiagnostic((DiagnosticInfo)(object)info2, instance4.First().GetFirstLocation()));
}
else
{
result = instance4[0];
}
}
instance3.Free();
instance4.Free();
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)noMainFoundDiagnostics).Free();
return result;
bool checkValid(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol candidate, bool flag2, BindingDiagnosticBag specificDiagnostics)
{
if (!flag2)
{
noMainFoundDiagnostics.Add(ErrorCode.WRN_InvalidMainSig, candidate.GetFirstLocation(), candidate);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)noMainFoundDiagnostics).AddRange((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)specificDiagnostics, false);
return false;
}
if (candidate.IsGenericMethod || candidate.ContainingType.IsGenericType)
{
noMainFoundDiagnostics.Add(ErrorCode.WRN_MainCantBeGeneric, candidate.GetFirstLocation(), candidate);
return false;
}
return true;
}
}
finally
{
instance2.Free();
sealedDiagnostics = ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).ToReadOnlyAndFree();
}
}
private static void AddEntryPointCandidates(ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol> entryPointCandidates, IEnumerable<Symbol> members)
{
foreach (Symbol member in members)
{
if (member is Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol { IsEntryPointCandidate: not false } methodSymbol)
{
entryPointCandidates.Add(methodSymbol);
}
}
}
internal bool ReturnsAwaitableToVoidOrInt(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method, BindingDiagnosticBag diagnostics)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Invalid comparison between Unknown and I4
if (method.ReturnType.IsVoidType() || (int)method.ReturnType.SpecialType == 13)
{
return false;
}
if (!(method.ReturnType is Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol))
{
return false;
}
if (!Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(namedTypeSymbol.ConstructedFrom, GetWellKnownType((WellKnownType)95), (TypeCompareKind)0) && !Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(namedTypeSymbol.ConstructedFrom, GetWellKnownType((WellKnownType)96), (TypeCompareKind)0))
{
return false;
}
CSharpSyntaxNode cSharpSyntaxNode = method.ExtractReturnTypeSyntax();
BoundLiteral expression = new BoundLiteral((SyntaxNode)(object)cSharpSyntaxNode, ConstantValue.Null, namedTypeSymbol);
if (GetBinder(cSharpSyntaxNode).GetAwaitableExpressionInfo(expression, out BoundExpression getAwaiterGetResultCall, (SyntaxNode)(object)cSharpSyntaxNode, diagnostics))
{
if (!getAwaiterGetResultCall.Type.IsVoidType())
{
return (int)getAwaiterGetResultCall.Type.SpecialType == 13;
}
return true;
}
return false;
}
internal (bool IsCandidate, bool IsTaskLike) HasEntryPointSignature(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method, BindingDiagnosticBag bag)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Invalid comparison between Unknown and I4
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Invalid comparison between Unknown and I4
if (method.IsVararg)
{
return (IsCandidate: false, IsTaskLike: false);
}
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol returnType = method.ReturnType;
bool flag = false;
if ((int)returnType.SpecialType != 13 && !returnType.IsVoidType())
{
flag = ReturnsAwaitableToVoidOrInt(method, bag);
if (!flag)
{
return (IsCandidate: false, IsTaskLike: false);
}
}
if ((int)method.RefKind != 0)
{
return (IsCandidate: false, IsTaskLike: flag);
}
if (method.Parameters.Length == 0)
{
return (IsCandidate: true, IsTaskLike: flag);
}
if (method.Parameters.Length > 1)
{
return (IsCandidate: false, IsTaskLike: flag);
}
if (!method.ParameterRefKinds.IsDefault)
{
return (IsCandidate: false, IsTaskLike: flag);
}
TypeWithAnnotations typeWithAnnotations = method.Parameters[0].TypeWithAnnotations;
if ((int)typeWithAnnotations.TypeKind != 1)
{
return (IsCandidate: false, IsTaskLike: flag);
}
Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol arrayTypeSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol)typeWithAnnotations.Type;
return (IsCandidate: arrayTypeSymbol.IsSZArray && (int)arrayTypeSymbol.ElementType.SpecialType == 20, IsTaskLike: flag);
}
internal override bool IsUnreferencedAssemblyIdentityDiagnosticCode(int code)
{
return code == 12;
}
internal bool MightContainNoPiaLocalTypes()
{
return SourceAssembly.MightContainNoPiaLocalTypes();
}
public Conversion ClassifyConversion(ITypeSymbol source, ITypeSymbol destination)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (source == null)
{
throw new ArgumentNullException("source");
}
if (destination == null)
{
throw new ArgumentNullException("destination");
}
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol source2 = source.EnsureCSharpSymbolOrNull("source");
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol destination2 = destination.EnsureCSharpSymbolOrNull("destination");
CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> useSiteInfo = CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Discarded;
return Conversions.ClassifyConversionFromType(source2, destination2, isChecked: false, ref useSiteInfo);
}
public override CommonConversion ClassifyCommonConversion(ITypeSymbol source, ITypeSymbol destination)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return ClassifyConversion(source, destination).ToCommonConversion();
}
internal override IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol? destination, out ConstantValue? constantValue)
{
constantValue = null;
if (destination == null)
{
return (IConvertibleConversion)(object)Conversion.NoConversion;
}
ITypeSymbol type = source.Type;
ConstantValue constantValue2 = OperationExtensions.GetConstantValue(source);
if (type == null)
{
if (constantValue2 != null && constantValue2.IsNull && destination.IsReferenceType)
{
constantValue = constantValue2;
return (IConvertibleConversion)(object)Conversion.NullLiteral;
}
return (IConvertibleConversion)(object)Conversion.NoConversion;
}
Conversion conversion = ClassifyConversion(type, destination);
if (conversion.IsReference && constantValue2 != null && constantValue2.IsNull)
{
constantValue = constantValue2;
}
return (IConvertibleConversion)(object)conversion;
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol CreateArrayTypeSymbol(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol elementType, int rank = 1, NullableAnnotation elementNullableAnnotation = NullableAnnotation.Oblivious)
{
if ((object)elementType == null)
{
throw new ArgumentNullException("elementType");
}
if (rank < 1)
{
throw new ArgumentException("rank");
}
return Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol.CreateCSharpArray(Assembly, TypeWithAnnotations.Create(elementType, elementNullableAnnotation), rank);
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.PointerTypeSymbol CreatePointerTypeSymbol(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol elementType, NullableAnnotation elementNullableAnnotation = NullableAnnotation.Oblivious)
{
if ((object)elementType == null)
{
throw new ArgumentNullException("elementType");
}
return new Microsoft.CodeAnalysis.CSharp.Symbols.PointerTypeSymbol(TypeWithAnnotations.Create(elementType, elementNullableAnnotation));
}
private protected override bool IsSymbolAccessibleWithinCore(ISymbol symbol, ISymbol within, ITypeSymbol? throughType)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
Symbol symbol2 = symbol.EnsureCSharpSymbolOrNull("symbol");
Symbol symbol3 = within.EnsureCSharpSymbolOrNull("within");
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol throughTypeOpt = throughType.EnsureCSharpSymbolOrNull("throughType");
CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> useSiteInfo = CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Discarded;
if ((int)symbol3.Kind != 2)
{
return AccessCheck.IsSymbolAccessible(symbol2, (Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol)symbol3, ref useSiteInfo, throughTypeOpt);
}
return AccessCheck.IsSymbolAccessible(symbol2, (Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol)symbol3, ref useSiteInfo);
}
[Obsolete("Compilation.IsSymbolAccessibleWithin is not designed for use within the compilers", true)]
internal bool IsSymbolAccessibleWithin(ISymbol symbol, ISymbol within, ITypeSymbol? throughType = null)
{
throw new NotImplementedException();
}
internal void AddModuleInitializerMethod(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method)
{
LazyInitializer.EnsureInitialized(ref _moduleInitializerMethods).Add(method);
}
internal void AddInterception(string filePath, int line, int character, Location attributeLocation, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol interceptor)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
ConcurrentDictionaryExtensions.AddOrUpdate<(string, int, int), OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>, (Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>(LazyInitializer.EnsureInitialized(ref _interceptions), (filePath, line, character), (Func<(string, int, int), (Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol), OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>>)(((string, int, int) key, (Location AttributeLocation, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol Interceptor) newValue) => OneOrMany.Create<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>(newValue)), (Func<(string, int, int), OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>, (Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol), OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>>)delegate((string, int, int) key, OneOrMany<(Location AttributeLocation, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol Interceptor)> existingValues, (Location AttributeLocation, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol Interceptor) newValue)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
Enumerator<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)> enumerator = existingValues.GetEnumerator();
while (enumerator.MoveNext())
{
var (val, methodSymbol) = enumerator.Current;
if (val == newValue.AttributeLocation && methodSymbol.Equals(newValue.Interceptor, (TypeCompareKind)0))
{
return existingValues;
}
}
return existingValues.Add(newValue);
}, (attributeLocation, interceptor));
}
internal (Location AttributeLocation, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol Interceptor)? TryGetInterceptor(Location? callLocation)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if (_interceptions == null || callLocation == null)
{
return null;
}
FileLinePositionSpan lineSpan = callLocation.GetLineSpan();
LinePositionSpan span = ((FileLinePositionSpan)(ref lineSpan)).Span;
LinePosition start = ((LinePositionSpan)(ref span)).Start;
(string, int, int) key = (callLocation.SourceTree.FilePath, ((LinePosition)(ref start)).Line, ((LinePosition)(ref start)).Character);
if (_interceptions.TryGetValue(key, out OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)> value))
{
if (value.Count == 1)
{
return value[0];
}
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs", 2393);
}
return null;
}
public SemanticModel GetSemanticModel(SyntaxTree syntaxTree, bool ignoreAccessibility)
{
if (syntaxTree == null)
{
throw new ArgumentNullException("syntaxTree");
}
if (!_syntaxAndDeclarations.GetLazyState().RootNamespaces.ContainsKey(syntaxTree))
{
throw new ArgumentException(CSharpResources.SyntaxTreeNotFound, "syntaxTree");
}
SemanticModel val = null;
if (((Compilation)this).SemanticModelProvider != null)
{
val = ((Compilation)this).SemanticModelProvider.GetSemanticModel(syntaxTree, (Compilation)(object)this, ignoreAccessibility);
}
return val ?? ((Compilation)this).CreateSemanticModel(syntaxTree, ignoreAccessibility);
}
internal override SemanticModel CreateSemanticModel(SyntaxTree syntaxTree, bool ignoreAccessibility)
{
return (SemanticModel)(object)new SyntaxTreeSemanticModel(this, syntaxTree, ignoreAccessibility);
}
internal BinderFactory GetBinderFactory(SyntaxTree syntaxTree, bool ignoreAccessibility = false)
{
if (ignoreAccessibility && (object)SynthesizedSimpleProgramEntryPointSymbol.GetSimpleProgramEntryPoint(this) != null)
{
return GetBinderFactory(syntaxTree, ignoreAccessibility: true, ref _ignoreAccessibilityBinderFactories);
}
return GetBinderFactory(syntaxTree, ignoreAccessibility: false, ref _binderFactories);
}
private BinderFactory GetBinderFactory(SyntaxTree syntaxTree, bool ignoreAccessibility, ref WeakReference<BinderFactory>[]? cachedBinderFactories)
{
int syntaxTreeOrdinal = ((Compilation)this).GetSyntaxTreeOrdinal(syntaxTree);
WeakReference<BinderFactory>[] array = cachedBinderFactories;
if (array == null)
{
array = new WeakReference<BinderFactory>[SyntaxTrees.Length];
array = Interlocked.CompareExchange(ref cachedBinderFactories, array, null) ?? array;
}
WeakReference<BinderFactory> weakReference = array[syntaxTreeOrdinal];
if (weakReference != null && weakReference.TryGetTarget(out var target))
{
return target;
}
return AddNewFactory(syntaxTree, ignoreAccessibility, ref array[syntaxTreeOrdinal]);
}
private BinderFactory AddNewFactory(SyntaxTree syntaxTree, bool ignoreAccessibility, [NotNull] ref WeakReference<BinderFactory>? slot)
{
BinderFactory binderFactory = new BinderFactory(this, syntaxTree, ignoreAccessibility);
WeakReference<BinderFactory> value = new WeakReference<BinderFactory>(binderFactory);
WeakReference<BinderFactory> weakReference;
do
{
weakReference = slot;
if (weakReference != null && weakReference.TryGetTarget(out var target))
{
return target;
}
}
while (Interlocked.CompareExchange(ref slot, value, weakReference) != weakReference);
return binderFactory;
}
internal Binder GetBinder(CSharpSyntaxNode syntax)
{
return GetBinderFactory(syntax.SyntaxTree).GetBinder((SyntaxNode)(object)syntax);
}
private Microsoft.CodeAnalysis.CSharp.Symbols.AliasSymbol CreateGlobalNamespaceAlias()
{
return Microsoft.CodeAnalysis.CSharp.Symbols.AliasSymbol.CreateGlobalNamespaceAlias(GlobalNamespace);
}
private void CompleteTree(SyntaxTree tree)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
if (_lazyCompilationUnitCompletedTrees == null)
{
Interlocked.CompareExchange(ref _lazyCompilationUnitCompletedTrees, new HashSet<SyntaxTree>(), null);
}
lock (_lazyCompilationUnitCompletedTrees)
{
if (_lazyCompilationUnitCompletedTrees.Add(tree))
{
((Compilation)this).EventQueue?.TryEnqueue((CompilationEvent)new CompilationUnitCompletedEvent((Compilation)(object)this, tree, (TextSpan?)null));
if (_lazyCompilationUnitCompletedTrees.Count == SyntaxTrees.Length)
{
((Compilation)this).CompleteCompilationEventQueue_NoLock();
}
}
}
}
internal override void ReportUnusedImports(DiagnosticBag diagnostics, CancellationToken cancellationToken)
{
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false);
ReportUnusedImports(null, instance, cancellationToken);
diagnostics.AddRange(((BindingDiagnosticBag)instance).DiagnosticBag);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).Free();
}
private void ReportUnusedImports(SyntaxTree? filterTree, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken)
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
if (_lazyImportInfos != null && (filterTree == null || Compilation.ReportUnusedImportsInTree(filterTree)))
{
PooledHashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol> val = null;
if (((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).DependenciesBag != null)
{
val = PooledHashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>.GetInstance();
}
foreach (KeyValuePair<ImportInfo, ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>> lazyImportInfo in _lazyImportInfos)
{
cancellationToken.ThrowIfCancellationRequested();
ImportInfo key = lazyImportInfo.Key;
SyntaxTree tree = key.Tree;
if ((filterTree != null && filterTree != tree) || !Compilation.ReportUnusedImportsInTree(tree))
{
continue;
}
TextSpan span = key.Span;
if (!((Compilation)this).IsImportDirectiveUsed(tree, ((TextSpan)(ref span)).Start))
{
ErrorCode code = ((key.Kind == SyntaxKind.ExternAliasDirective) ? ErrorCode.HDN_UnusedExternAlias : ErrorCode.HDN_UnusedUsingDirective);
diagnostics.Add(code, tree.GetLocation(span));
}
else
{
if (((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).DependenciesBag == null)
{
continue;
}
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> value = lazyImportInfo.Value;
if (!value.IsDefaultOrEmpty)
{
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).AddDependencies(value);
}
else
{
if (key.Kind != SyntaxKind.ExternAliasDirective)
{
continue;
}
SyntaxToken val2 = key.Tree.GetRoot(cancellationToken).FindToken(((TextSpan)(ref key.Span)).Start, false);
ExternAliasDirectiveSyntax externAliasDirectiveSyntax = ((SyntaxToken)(ref val2)).Parent.FirstAncestorOrSelf<ExternAliasDirectiveSyntax>((Func<ExternAliasDirectiveSyntax, bool>)null, true);
if (externAliasDirectiveSyntax != null)
{
val2 = externAliasDirectiveSyntax.Identifier;
if (GetExternAliasTarget(((SyntaxToken)(ref val2)).ValueText, out Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol @namespace))
{
((HashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>)(object)val).Add(@namespace);
}
}
}
}
}
if (val != null)
{
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance(withDiagnostics: false, withDependencies: true);
foreach (Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol item in (HashSet<Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol>)(object)val)
{
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).Clear();
instance.AddAssembliesUsedByNamespaceReference(item);
ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>? lazyUsedAssemblyReferences = _lazyUsedAssemblyReferences;
if ((lazyUsedAssemblyReferences != null && !lazyUsedAssemblyReferences.IsEmpty) || ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).DependenciesBag.Count != 0)
{
foreach (Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol item2 in ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).DependenciesBag)
{
ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>? lazyUsedAssemblyReferences2 = _lazyUsedAssemblyReferences;
if ((lazyUsedAssemblyReferences2 != null && lazyUsedAssemblyReferences2.Contains(item2)) || ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).DependenciesBag.Contains(item2))
{
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).DependenciesBag.Clear();
break;
}
}
}
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)diagnostics).AddDependencies((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance, false);
}
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).Free();
val.Free();
}
}
((Compilation)this).CompleteTrees(filterTree);
}
internal override void CompleteTrees(SyntaxTree? filterTree)
{
if (((Compilation)this).EventQueue != null)
{
if (filterTree != null)
{
CompleteTree(filterTree);
}
else
{
ImmutableArray<SyntaxTree>.Enumerator enumerator = SyntaxTrees.GetEnumerator();
while (enumerator.MoveNext())
{
SyntaxTree current = enumerator.Current;
CompleteTree(current);
}
}
}
if (filterTree == null)
{
_usageOfUsingsRecordedInTrees = null;
}
}
internal void RecordImport(UsingDirectiveSyntax syntax)
{
RecordImportInternal(syntax);
}
internal void RecordImport(ExternAliasDirectiveSyntax syntax)
{
RecordImportInternal(syntax);
}
private void RecordImportInternal(CSharpSyntaxNode syntax)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
LazyInitializer.EnsureInitialized(ref _lazyImportInfos).TryAdd(new ImportInfo(syntax.SyntaxTree, syntax.Kind(), ((SyntaxNode)syntax).Span), default(ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>));
}
internal void RecordImportDependencies(UsingDirectiveSyntax syntax, ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> dependencies)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
_lazyImportInfos.TryUpdate(new ImportInfo(syntax.SyntaxTree, syntax.Kind(), ((SyntaxNode)syntax).Span), dependencies, default(ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>));
}
public override ImmutableArray<Diagnostic> GetParseDiagnostics(CancellationToken cancellationToken = default(CancellationToken))
{
return GetDiagnostics((CompilationStage)0, includeEarlierStages: false, cancellationToken);
}
public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(CancellationToken cancellationToken = default(CancellationToken))
{
return GetDiagnostics((CompilationStage)1, includeEarlierStages: false, cancellationToken);
}
public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(CancellationToken cancellationToken = default(CancellationToken))
{
return GetDiagnostics((CompilationStage)2, includeEarlierStages: false, cancellationToken);
}
public override ImmutableArray<Diagnostic> GetDiagnostics(CancellationToken cancellationToken = default(CancellationToken))
{
return GetDiagnostics((CompilationStage)2, includeEarlierStages: true, cancellationToken);
}
internal ImmutableArray<Diagnostic> GetDiagnostics(CompilationStage stage, bool includeEarlierStages, CancellationToken cancellationToken)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
DiagnosticBag instance = DiagnosticBag.GetInstance();
((Compilation)this).GetDiagnostics(stage, includeEarlierStages, instance, cancellationToken);
return instance.ToReadOnlyAndFree();
}
internal override void GetDiagnostics(CompilationStage stage, bool includeEarlierStages, DiagnosticBag diagnostics, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false);
GetDiagnosticsWithoutFiltering(stage, includeEarlierStages, instance, cancellationToken);
((Compilation)this).FilterAndAppendDiagnostics(diagnostics, ((BindingDiagnosticBag)instance).DiagnosticBag, cancellationToken);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).Free();
}
private void GetDiagnosticsWithoutFiltering(CompilationStage stage, bool includeEarlierStages, BindingDiagnosticBag builder, CancellationToken cancellationToken)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Invalid comparison between Unknown and I4
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Invalid comparison between Unknown and I4
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Invalid comparison between Unknown and I4
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Invalid comparison between Unknown and I4
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
if ((int)stage == 0 || ((int)stage > 0 && includeEarlierStages))
{
ImmutableArray<SyntaxTree> syntaxTrees = SyntaxTrees;
ImmutableArray<SyntaxTree>.Enumerator enumerator;
if (((CompilationOptions)Options).ConcurrentBuild)
{
RoslynParallel.For(0, syntaxTrees.Length, UICultureUtilities.WithCurrentUICulture<int>((Action<int>)delegate(int i)
{
SyntaxTree val = syntaxTrees[i];
AppendLoadDirectiveDiagnostics(((BindingDiagnosticBag)builder).DiagnosticBag, _syntaxAndDeclarations, val);
((BindingDiagnosticBag)builder).AddRange(val.GetDiagnostics(cancellationToken));
}), cancellationToken);
}
else
{
enumerator = syntaxTrees.GetEnumerator();
while (enumerator.MoveNext())
{
SyntaxTree current = enumerator.Current;
cancellationToken.ThrowIfCancellationRequested();
AppendLoadDirectiveDiagnostics(((BindingDiagnosticBag)builder).DiagnosticBag, _syntaxAndDeclarations, current);
cancellationToken.ThrowIfCancellationRequested();
((BindingDiagnosticBag)builder).AddRange(current.GetDiagnostics(cancellationToken));
}
}
HashSet<ParseOptions> hashSet = new HashSet<ParseOptions>();
enumerator = syntaxTrees.GetEnumerator();
while (enumerator.MoveNext())
{
SyntaxTree current2 = enumerator.Current;
cancellationToken.ThrowIfCancellationRequested();
if (!current2.Options.Errors.IsDefaultOrEmpty && hashSet.Add(current2.Options))
{
Location location = current2.GetLocation(TextSpan.FromBounds(0, 0));
ImmutableArray<Diagnostic>.Enumerator enumerator2 = current2.Options.Errors.GetEnumerator();
while (enumerator2.MoveNext())
{
Diagnostic current3 = enumerator2.Current;
((BindingDiagnosticBag)builder).Add(current3.WithLocation(location));
}
}
}
}
if ((int)stage == 1 || ((int)stage > 1 && includeEarlierStages))
{
((Compilation)this).CheckAssemblyName(((BindingDiagnosticBag)builder).DiagnosticBag);
((BindingDiagnosticBag)builder).AddRange<Diagnostic>(((CompilationOptions)Options).Errors);
if ((int)((CompilationOptions)Options).NullableContextOptions != 0 && LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion() && ((CommonSyntaxAndDeclarationManager)_syntaxAndDeclarations).ExternalSyntaxTrees.Any())
{
((BindingDiagnosticBag)builder).Add((Diagnostic)(object)new CSDiagnostic((DiagnosticInfo)(object)new CSDiagnosticInfo(ErrorCode.ERR_NullableOptionNotAvailable, "NullableContextOptions", ((CompilationOptions)Options).NullableContextOptions, LanguageVersion.ToDisplayString(), new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())), Location.None));
}
cancellationToken.ThrowIfCancellationRequested();
((BindingDiagnosticBag)builder).AddRange<Diagnostic>(((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).Diagnostics);
cancellationToken.ThrowIfCancellationRequested();
BindingDiagnosticBag bindingDiagnosticBag = builder;
CancellationToken cancellationToken2 = cancellationToken;
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)bindingDiagnosticBag).AddRange(GetSourceDeclarationDiagnostics(null, null, null, cancellationToken2), true);
if (((Compilation)this).EventQueue != null && SyntaxTrees.Length == 0)
{
((Compilation)this).EnsureCompilationEventQueueCompleted();
}
}
cancellationToken.ThrowIfCancellationRequested();
if ((int)stage == 2 || ((int)stage > 2 && includeEarlierStages))
{
BindingDiagnosticBag bindingDiagnosticBag2 = (((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)builder).AccumulatesDependencies ? BindingDiagnosticBag.GetConcurrentInstance() : BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false));
GetDiagnosticsForAllMethodBodies(bindingDiagnosticBag2, doLowering: false, cancellationToken);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)builder).AddRangeAndFree((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)bindingDiagnosticBag2);
}
}
private static void AppendLoadDirectiveDiagnostics(DiagnosticBag builder, SyntaxAndDeclarationManager syntaxAndDeclarations, SyntaxTree syntaxTree, Func<IEnumerable<Diagnostic>, IEnumerable<Diagnostic>>? locationFilterOpt = null)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
if (!syntaxAndDeclarations.GetLazyState().LoadDirectiveMap.TryGetValue(syntaxTree, out var value))
{
return;
}
ImmutableArray<LoadDirective>.Enumerator enumerator = value.GetEnumerator();
while (enumerator.MoveNext())
{
IEnumerable<Diagnostic> enumerable = enumerator.Current.Diagnostics;
if (locationFilterOpt != null)
{
enumerable = locationFilterOpt(enumerable);
}
builder.AddRange(enumerable);
}
}
private void GetDiagnosticsForAllMethodBodies(BindingDiagnosticBag diagnostics, bool doLowering, CancellationToken cancellationToken)
{
MethodCompiler.CompileMethodBodies(this, doLowering ? ((PEModuleBuilder)(object)((Compilation)this).CreateModuleBuilder(EmitOptions.Default, (IMethodSymbol)null, (Stream)null, (IEnumerable<EmbeddedText>)null, (IEnumerable<ResourceDescription>)null, (CompilationTestData)null, ((BindingDiagnosticBag)diagnostics).DiagnosticBag, cancellationToken)) : null, emittingPdb: false, hasDeclarationErrors: false, emitMethodBodies: false, diagnostics, null, cancellationToken);
DocumentationCommentCompiler.WriteDocumentationCommentXml(this, null, null, diagnostics, cancellationToken);
ReportUnusedImports(null, diagnostics, cancellationToken);
}
private static bool IsDefinedOrImplementedInSourceTree(Symbol symbol, SyntaxTree tree, TextSpan? span)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Invalid comparison between Unknown and I4
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
if (symbol.IsDefinedInSourceTree(tree, span))
{
return true;
}
if ((int)symbol.Kind == 9 && symbol.IsImplicitlyDeclared && (int)((Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)symbol).MethodKind == 1)
{
return IsDefinedOrImplementedInSourceTree(symbol.ContainingType, tree, span);
}
return false;
}
private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false);
bool flag = (!span.HasValue || span.Value == tree.GetRoot(cancellationToken).FullSpan) && Compilation.ReportUnusedImportsInTree(tree);
bool flag2 = false;
if (flag && UsageOfUsingsRecordedInTrees != null)
{
ImmutableArray<SingleNamespaceDeclaration>.Enumerator enumerator = ((SourceNamespaceSymbol)SourceModule.GlobalNamespace).MergedDeclaration.Declarations.GetEnumerator();
while (enumerator.MoveNext())
{
SingleNamespaceDeclaration current = enumerator.Current;
if (current.SyntaxReference.SyntaxTree == tree)
{
if (current.HasGlobalUsings)
{
flag2 = true;
}
break;
}
}
}
if (flag2)
{
ImmutableHashSet<SyntaxTree>? usageOfUsingsRecordedInTrees = UsageOfUsingsRecordedInTrees;
if (usageOfUsingsRecordedInTrees != null && usageOfUsingsRecordedInTrees.IsEmpty)
{
compileMethodBodiesAndDocComments(null, null, instance, cancellationToken);
_usageOfUsingsRecordedInTrees = null;
goto IL_0158;
}
}
compileMethodBodiesAndDocComments(tree, span, instance, cancellationToken);
if (flag)
{
registeredUsageOfUsingsInTree(tree);
}
if (flag2)
{
BindingDiagnosticBag instance2 = BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false);
ImmutableArray<SyntaxTree>.Enumerator enumerator2 = SyntaxTrees.GetEnumerator();
while (enumerator2.MoveNext())
{
SyntaxTree current2 = enumerator2.Current;
ImmutableHashSet<SyntaxTree> usageOfUsingsRecordedInTrees2 = UsageOfUsingsRecordedInTrees;
if (usageOfUsingsRecordedInTrees2 == null)
{
break;
}
if (!usageOfUsingsRecordedInTrees2.Contains(current2))
{
compileMethodBodiesAndDocComments(current2, null, instance2, cancellationToken);
registeredUsageOfUsingsInTree(current2);
((BindingDiagnosticBag)instance2).DiagnosticBag.Clear();
}
}
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance2).Free();
}
goto IL_0158;
IL_0158:
if (flag)
{
ReportUnusedImports(tree, instance, cancellationToken);
}
return ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).ToReadOnlyAndFree().Diagnostics;
void compileMethodBodiesAndDocComments(SyntaxTree? filterTree, TextSpan? filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken2)
{
MethodCompiler.CompileMethodBodies(this, null, emittingPdb: false, hasDeclarationErrors: false, emitMethodBodies: false, bindingDiagnostics, (filterTree != null) ? ((Predicate<Symbol>)((Symbol s) => IsDefinedOrImplementedInSourceTree(s, filterTree, filterSpan))) : null, cancellationToken2);
DocumentationCommentCompiler.WriteDocumentationCommentXml(this, null, null, bindingDiagnostics, cancellationToken2, filterTree, filterSpan);
}
void registeredUsageOfUsingsInTree(SyntaxTree item)
{
ImmutableHashSet<SyntaxTree> immutableHashSet = UsageOfUsingsRecordedInTrees;
while (immutableHashSet != null)
{
ImmutableHashSet<SyntaxTree> immutableHashSet2 = immutableHashSet.Add(item);
if (immutableHashSet2 == immutableHashSet)
{
break;
}
if (immutableHashSet2.Count == SyntaxTrees.Length)
{
_usageOfUsingsRecordedInTrees = null;
break;
}
ImmutableHashSet<SyntaxTree> immutableHashSet3 = Interlocked.CompareExchange(ref _usageOfUsingsRecordedInTrees, immutableHashSet2, immutableHashSet);
if (immutableHashSet3 == immutableHashSet)
{
break;
}
immutableHashSet = immutableHashSet3;
}
}
}
private ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> GetSourceDeclarationDiagnostics(SyntaxTree? syntaxTree = null, TextSpan? filterSpanWithinTree = null, Func<IEnumerable<Diagnostic>, SyntaxTree, TextSpan?, IEnumerable<Diagnostic>>? locationFilterOpt = null, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_003b: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
UsingsFromOptions.Complete(this, cancellationToken);
SourceLocation locationOpt = null;
if (syntaxTree != null)
{
SyntaxNode root = syntaxTree.GetRoot(cancellationToken);
locationOpt = (filterSpanWithinTree.HasValue ? new SourceLocation(syntaxTree, filterSpanWithinTree.Value) : new SourceLocation(root));
}
Assembly.ForceComplete(locationOpt, cancellationToken);
if (syntaxTree == null)
{
_declarationDiagnosticsFrozen = true;
_needsGeneratedAttributes_IsFrozen = true;
}
DiagnosticBag? lazyDeclarationDiagnostics = _lazyDeclarationDiagnostics;
IEnumerable<Diagnostic> enumerable = ((lazyDeclarationDiagnostics != null) ? lazyDeclarationDiagnostics.AsEnumerable() : null) ?? Enumerable.Empty<Diagnostic>();
if (locationFilterOpt != null)
{
enumerable = locationFilterOpt(enumerable, syntaxTree, filterSpanWithinTree);
}
ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> clsComplianceDiagnostics = GetClsComplianceDiagnostics(syntaxTree, filterSpanWithinTree, cancellationToken);
return new ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(ImmutableArrayExtensions.Concat<Diagnostic>(ImmutableArrayExtensions.AsImmutable<Diagnostic>(enumerable), clsComplianceDiagnostics.Diagnostics), clsComplianceDiagnostics.Dependencies);
}
private ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> GetClsComplianceDiagnostics(SyntaxTree? syntaxTree, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
if (syntaxTree != null)
{
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false);
ClsComplianceChecker.CheckCompliance(this, instance, cancellationToken, syntaxTree, filterSpanWithinTree);
return ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).ToReadOnlyAndFree();
}
if (_lazyClsComplianceDiagnostics.IsDefault || _lazyClsComplianceDependencies.IsDefault)
{
BindingDiagnosticBag instance2 = BindingDiagnosticBag.GetInstance();
ClsComplianceChecker.CheckCompliance(this, instance2, cancellationToken);
ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> val = ((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance2).ToReadOnlyAndFree();
ImmutableInterlocked.InterlockedInitialize(ref _lazyClsComplianceDependencies, val.Dependencies);
ImmutableInterlocked.InterlockedInitialize(ref _lazyClsComplianceDiagnostics, val.Diagnostics);
}
return new ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(_lazyClsComplianceDiagnostics, _lazyClsComplianceDependencies);
}
private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree)
{
foreach (Diagnostic diagnostic in diagnostics)
{
if (diagnostic.HasIntersectingLocation(tree, filterSpanWithinTree))
{
yield return diagnostic;
}
}
}
internal ImmutableArray<Diagnostic> GetDiagnosticsForSyntaxTree(CompilationStage stage, SyntaxTree syntaxTree, TextSpan? filterSpanWithinTree, bool includeEarlierStages, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Invalid comparison between Unknown and I4
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Invalid comparison between Unknown and I4
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Invalid comparison between Unknown and I4
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Invalid comparison between Unknown and I4
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Invalid comparison between Unknown and I4
cancellationToken.ThrowIfCancellationRequested();
DiagnosticBag instance = DiagnosticBag.GetInstance();
if ((int)stage == 0 || ((int)stage > 0 && includeEarlierStages))
{
AppendLoadDirectiveDiagnostics(instance, _syntaxAndDeclarations, syntaxTree, (IEnumerable<Diagnostic> diagnostics3) => FilterDiagnosticsByLocation(diagnostics3, syntaxTree, filterSpanWithinTree));
IEnumerable<Diagnostic> diagnostics = syntaxTree.GetDiagnostics(cancellationToken);
diagnostics = FilterDiagnosticsByLocation(diagnostics, syntaxTree, filterSpanWithinTree);
instance.AddRange(diagnostics);
}
cancellationToken.ThrowIfCancellationRequested();
if ((int)stage == 1 || ((int)stage > 1 && includeEarlierStages))
{
ImmutableBindingDiagnostic<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> sourceDeclarationDiagnostics = GetSourceDeclarationDiagnostics(syntaxTree, filterSpanWithinTree, FilterDiagnosticsByLocation, cancellationToken);
instance.AddRange<Diagnostic>(sourceDeclarationDiagnostics.Diagnostics);
}
cancellationToken.ThrowIfCancellationRequested();
if ((int)stage == 2 || ((int)stage > 2 && includeEarlierStages))
{
IEnumerable<Diagnostic> diagnostics2 = GetDiagnosticsForMethodBodiesInTree(syntaxTree, filterSpanWithinTree, cancellationToken);
diagnostics2 = FilterDiagnosticsByLocation(diagnostics2, syntaxTree, filterSpanWithinTree);
instance.AddRange(diagnostics2);
}
DiagnosticBag instance2 = DiagnosticBag.GetInstance();
((Compilation)this).FilterAndAppendAndFreeDiagnostics(instance2, ref instance, cancellationToken);
return instance2.ToReadOnlyAndFree<Diagnostic>();
}
protected override void AppendDefaultVersionResource(Stream resourceStream)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssembly = SourceAssembly;
string text = sourceAssembly.FileVersion ?? sourceAssembly.Identity.Version.ToString();
bool num = !EnumBounds.IsApplication(((CompilationOptions)Options).OutputKind);
string name = SourceModule.Name;
string name2 = SourceModule.Name;
string obj = sourceAssembly.InformationalVersion ?? text;
string text2 = sourceAssembly.Title ?? " ";
Win32ResourceConversions.AppendVersionToResourceStream(resourceStream, num, text, name, name2, obj, sourceAssembly.Identity.Version, text2, sourceAssembly.Copyright ?? " ", sourceAssembly.Trademark, sourceAssembly.Product, sourceAssembly.Description, sourceAssembly.Company);
}
internal override CommonPEModuleBuilder? CreateModuleBuilder(EmitOptions emitOptions, IMethodSymbol? debugEntryPoint, Stream? sourceLinkStream, IEnumerable<EmbeddedText>? embeddedTexts, IEnumerable<ResourceDescription>? manifestResources, CompilationTestData? testData, DiagnosticBag diagnostics, CancellationToken cancellationToken)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
string runtimeMetadataVersion = GetRuntimeMetadataVersion(emitOptions, diagnostics);
if (runtimeMetadataVersion == null)
{
return null;
}
ModulePropertiesForSerialization serializationProperties = ((Compilation)this).ConstructModuleSerializationProperties(emitOptions, runtimeMetadataVersion, default(Guid));
if (manifestResources == null)
{
manifestResources = SpecializedCollections.EmptyEnumerable<ResourceDescription>();
}
PEModuleBuilder pEModuleBuilder;
if (EnumBounds.IsNetModule(((CompilationOptions)_options).OutputKind))
{
pEModuleBuilder = new PENetModuleBuilder((SourceModuleSymbol)SourceModule, emitOptions, serializationProperties, manifestResources);
}
else
{
OutputKind outputKind = (OutputKind)((!EnumBounds.IsValid(((CompilationOptions)_options).OutputKind)) ? 2 : ((int)((CompilationOptions)_options).OutputKind));
pEModuleBuilder = new PEAssemblyBuilder(SourceAssembly, emitOptions, outputKind, serializationProperties, manifestResources);
}
if (debugEntryPoint != null)
{
((CommonPEModuleBuilder)pEModuleBuilder).SetDebugEntryPoint((IMethodSymbolInternal)(object)debugEntryPoint.GetSymbol(), diagnostics);
}
((CommonPEModuleBuilder)pEModuleBuilder).SourceLinkStreamOpt = sourceLinkStream;
if (embeddedTexts != null)
{
((CommonPEModuleBuilder)pEModuleBuilder).EmbeddedTexts = embeddedTexts;
}
if (testData != null)
{
((CommonPEModuleBuilder)pEModuleBuilder).SetTestData(testData);
}
return (CommonPEModuleBuilder?)(object)pEModuleBuilder;
}
internal override bool CompileMethods(CommonPEModuleBuilder moduleBuilder, bool emittingPdb, DiagnosticBag diagnostics, Predicate<ISymbolInternal>? filterOpt, CancellationToken cancellationToken)
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Expected O, but got Unknown
bool emitMetadataOnly = moduleBuilder.EmitOptions.EmitMetadataOnly;
PooledHashSet<int> val = null;
if (emitMetadataOnly)
{
val = PooledHashSet<int>.GetInstance();
((HashSet<int>)(object)val).Add(501);
}
bool flag = !((Compilation)this).FilterAndAppendDiagnostics(diagnostics, (IEnumerable<Diagnostic>)GetDiagnostics((CompilationStage)1, includeEarlierStages: true, cancellationToken), (HashSet<int>)(object)val, cancellationToken);
val?.Free();
PEModuleBuilder pEModuleBuilder = (PEModuleBuilder)(object)moduleBuilder;
if (emitMetadataOnly)
{
if (flag)
{
return false;
}
if (((PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, SyntaxNode, EmbeddedTypesManager, ModuleCompilationState>)pEModuleBuilder).SourceModule.HasBadAttributes)
{
diagnostics.Add(ErrorCode.ERR_ModuleEmitFailure, NoLocation.Singleton, ((INamedEntity)pEModuleBuilder).Name, (object)new LocalizableResourceString("ModuleHasInvalidAttributes", CodeAnalysisResources.ResourceManager, typeof(CodeAnalysisResources)));
return false;
}
SynthesizedMetadataCompiler.ProcessSynthesizedMembers(this, pEModuleBuilder, cancellationToken);
}
else
{
if ((emittingPdb || ((CommonPEModuleBuilder)pEModuleBuilder).EmitOptions.InstrumentationKinds.Contains((InstrumentationKind)1)) && !((Compilation)this).CreateDebugDocuments(((CommonPEModuleBuilder)pEModuleBuilder).DebugDocumentsBuilder, ((CommonPEModuleBuilder)pEModuleBuilder).EmbeddedTexts, diagnostics))
{
return false;
}
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false);
MethodCompiler.CompileMethodBodies(this, pEModuleBuilder, emittingPdb, flag, emitMethodBodies: true, instance, (Predicate<Symbol>)filterOpt, cancellationToken);
if (!flag && !CommonCompiler.HasUnsuppressableErrors(((BindingDiagnosticBag)instance).DiagnosticBag))
{
GenerateModuleInitializer(pEModuleBuilder, ((BindingDiagnosticBag)instance).DiagnosticBag);
}
bool flag2 = CheckDuplicateFilePaths(diagnostics);
bool flag3 = !((Compilation)this).FilterAndAppendDiagnostics(diagnostics, ((BindingDiagnosticBag)instance).DiagnosticBag, cancellationToken);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).Free();
if (flag || flag3 || flag2)
{
return false;
}
}
return true;
}
private bool CheckDuplicateFilePaths(DiagnosticBag diagnostics)
{
return new DuplicateFilePathsVisitor(diagnostics).CheckDuplicateFilePathsAndFree(SyntaxTrees, GlobalNamespace);
}
internal bool CheckDuplicateInterceptions(BindingDiagnosticBag diagnostics)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (_interceptions == null)
{
return false;
}
bool result = false;
(string, int, int) tuple = default((string, int, int));
OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)> val = default(OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>);
foreach (KeyValuePair<(string, int, int), OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>> interception in _interceptions)
{
KeyValuePairUtil.Deconstruct<(string, int, int), OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)>>(interception, ref tuple, ref val);
OneOrMany<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)> val2 = val;
if (val2.Count != 1)
{
result = true;
Enumerator<(Location, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)> enumerator2 = val2.GetEnumerator();
while (enumerator2.MoveNext())
{
Location item = enumerator2.Current.Item1;
diagnostics.Add(ErrorCode.ERR_DuplicateInterceptor, item);
}
}
}
return result;
}
private void GenerateModuleInitializer(PEModuleBuilder moduleBeingBuilt, DiagnosticBag methodBodyDiagnosticBag)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
if (_moduleInitializerMethods == null)
{
return;
}
ILBuilder val = new ILBuilder((ITokenDeferral)(object)moduleBeingBuilt, new LocalSlotManager((VariableSlotAllocator)null), (OptimizationLevel)1, false);
foreach (Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol item in EnumerableExtensions.OrderBy<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>((IEnumerable<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>)_moduleInitializerMethods, (IComparer<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol>)LexicalOrderSymbolComparer.Instance))
{
val.EmitOpCode(ILOpCode.Call, 0);
val.EmitToken((ISignature)(object)((PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, SyntaxNode, EmbeddedTypesManager, ModuleCompilationState>)moduleBeingBuilt).Translate(item, methodBodyDiagnosticBag, true), CSharpSyntaxTree.Dummy.GetRoot(default(CancellationToken)), methodBodyDiagnosticBag);
}
val.EmitRet(true);
val.Realize();
((PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, SyntaxNode, EmbeddedTypesManager, ModuleCompilationState>)moduleBeingBuilt).RootModuleType.SetStaticConstructorBody(val.RealizedIL);
}
internal override bool GenerateResources(CommonPEModuleBuilder moduleBuilder, Stream? win32Resources, bool useRawWin32Resources, DiagnosticBag diagnostics, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
DiagnosticBag instance = DiagnosticBag.GetInstance();
((Compilation)this).SetupWin32Resources(moduleBuilder, win32Resources, useRawWin32Resources, instance);
((Compilation)this).ReportManifestResourceDuplicates(moduleBuilder.ManifestResources, from m in SourceAssembly.Modules.Skip(1)
select m.Name, AddedModulesResourceNames(instance), instance);
return ((Compilation)this).FilterAndAppendAndFreeDiagnostics(diagnostics, ref instance, cancellationToken);
}
internal override bool GenerateDocumentationComments(Stream? xmlDocStream, string? outputNameOverride, DiagnosticBag diagnostics, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
BindingDiagnosticBag instance = BindingDiagnosticBag.GetInstance(withDiagnostics: true, withDependencies: false);
string assemblyName = FileNameUtilities.ChangeExtension(outputNameOverride, (string)null);
DocumentationCommentCompiler.WriteDocumentationCommentXml(this, assemblyName, xmlDocStream, instance, cancellationToken);
bool result = ((Compilation)this).FilterAndAppendDiagnostics(diagnostics, ((BindingDiagnosticBag)instance).DiagnosticBag, cancellationToken);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)instance).Free();
return result;
}
private IEnumerable<string> AddedModulesResourceNames(DiagnosticBag diagnostics)
{
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.ModuleSymbol> modules = SourceAssembly.Modules;
for (int i = 1; i < modules.Length; i++)
{
PEModuleSymbol pEModuleSymbol = (PEModuleSymbol)modules[i];
ImmutableArray<EmbeddedResource> embeddedResourcesOrThrow;
try
{
embeddedResourcesOrThrow = pEModuleSymbol.Module.GetEmbeddedResourcesOrThrow();
}
catch (BadImageFormatException)
{
diagnostics.Add((DiagnosticInfo)(object)new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, pEModuleSymbol), NoLocation.Singleton);
continue;
}
ImmutableArray<EmbeddedResource>.Enumerator enumerator = embeddedResourcesOrThrow.GetEnumerator();
while (enumerator.MoveNext())
{
EmbeddedResource current = enumerator.Current;
yield return current.Name;
}
}
}
internal override EmitDifferenceResult EmitDifference(EmitBaseline baseline, IEnumerable<SemanticEdit> edits, Func<ISymbol, bool> isAddedSymbol, Stream metadataStream, Stream ilStream, Stream pdbStream, CompilationTestData? testData, CancellationToken cancellationToken)
{
return EmitHelpers.EmitDifference(this, baseline, edits, isAddedSymbol, metadataStream, ilStream, pdbStream, testData, cancellationToken);
}
internal string? GetRuntimeMetadataVersion(EmitOptions emitOptions, DiagnosticBag diagnostics)
{
string runtimeMetadataVersion = GetRuntimeMetadataVersion(emitOptions);
if (runtimeMetadataVersion != null)
{
return runtimeMetadataVersion;
}
DiagnosticBag instance = DiagnosticBag.GetInstance();
instance.Add(ErrorCode.WRN_NoRuntimeMetadataVersion, NoLocation.Singleton);
if (!((Compilation)this).FilterAndAppendAndFreeDiagnostics(diagnostics, ref instance, CancellationToken.None))
{
return null;
}
return string.Empty;
}
private string? GetRuntimeMetadataVersion(EmitOptions emitOptions)
{
if (Assembly.CorLibrary is PEAssemblySymbol pEAssemblySymbol)
{
return pEAssemblySymbol.Assembly.ManifestModule.MetadataVersion;
}
return emitOptions.RuntimeMetadataVersion;
}
internal override void AddDebugSourceDocumentsForChecksumDirectives(DebugDocumentsBuilder documentsBuilder, SyntaxTree tree, DiagnosticBag diagnostics)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
foreach (PragmaChecksumDirectiveTriviaSyntax directive in tree.GetRoot(default(CancellationToken)).GetDirectives((DirectiveTriviaSyntax d) => d.Kind() == SyntaxKind.PragmaChecksumDirectiveTrivia && !((SyntaxNode)d).ContainsDiagnostics))
{
SyntaxToken val = directive.File;
string valueText = ((SyntaxToken)(ref val)).ValueText;
val = directive.Bytes;
string valueText2 = ((SyntaxToken)(ref val)).ValueText;
string text = documentsBuilder.NormalizeDebugDocumentPath(valueText, tree.FilePath);
DebugSourceDocument val2 = documentsBuilder.TryGetDebugDocumentForNormalizedPath(text);
if (val2 != null)
{
if (val2.IsComputedChecksum)
{
continue;
}
DebugSourceInfo sourceInfo = val2.GetSourceInfo();
if (ChecksumMatches(valueText2, sourceInfo.Checksum))
{
val = directive.Guid;
if (Guid.Parse(((SyntaxToken)(ref val)).ValueText) == sourceInfo.ChecksumAlgorithmId)
{
continue;
}
}
diagnostics.Add(ErrorCode.WRN_ConflictingChecksum, (Location)new SourceLocation((SyntaxNode)(object)directive), valueText);
}
else
{
Guid corSymLanguageTypeCSharp = DebugSourceDocument.CorSymLanguageTypeCSharp;
ImmutableArray<byte> immutableArray = MakeChecksumBytes(valueText2);
val = directive.Guid;
DebugSourceDocument val3 = new DebugSourceDocument(text, corSymLanguageTypeCSharp, immutableArray, Guid.Parse(((SyntaxToken)(ref val)).ValueText));
documentsBuilder.AddDebugDocument(val3);
}
}
}
private static bool ChecksumMatches(string bytesText, ImmutableArray<byte> bytes)
{
if (bytesText.Length != bytes.Length * 2)
{
return false;
}
int i = 0;
for (int num = bytesText.Length / 2; i < num; i++)
{
if (SyntaxFacts.HexValue(bytesText[i * 2]) * 16 + SyntaxFacts.HexValue(bytesText[i * 2 + 1]) != bytes[i])
{
return false;
}
}
return true;
}
private static ImmutableArray<byte> MakeChecksumBytes(string bytesText)
{
int num = bytesText.Length / 2;
ArrayBuilder<byte> instance = ArrayBuilder<byte>.GetInstance(num);
for (int i = 0; i < num; i++)
{
int num2 = SyntaxFacts.HexValue(bytesText[i * 2]) * 16 + SyntaxFacts.HexValue(bytesText[i * 2 + 1]);
instance.Add((byte)num2);
}
return instance.ToImmutableAndFree();
}
internal override bool HasCodeToEmit()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
ImmutableArray<SyntaxTree>.Enumerator enumerator = SyntaxTrees.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Current.GetCompilationUnitRoot().Members.Count > 0)
{
return true;
}
}
return false;
}
protected override Compilation CommonWithReferences(IEnumerable<MetadataReference> newReferences)
{
return (Compilation)(object)WithReferences(newReferences);
}
protected override Compilation CommonWithAssemblyName(string? assemblyName)
{
return (Compilation)(object)WithAssemblyName(assemblyName);
}
protected override SemanticModel CommonGetSemanticModel(SyntaxTree syntaxTree, bool ignoreAccessibility)
{
return GetSemanticModel(syntaxTree, ignoreAccessibility);
}
protected override Compilation CommonAddSyntaxTrees(IEnumerable<SyntaxTree> trees)
{
return (Compilation)(object)AddSyntaxTrees(trees);
}
protected override Compilation CommonRemoveSyntaxTrees(IEnumerable<SyntaxTree> trees)
{
return (Compilation)(object)RemoveSyntaxTrees(trees);
}
protected override Compilation CommonRemoveAllSyntaxTrees()
{
return (Compilation)(object)RemoveAllSyntaxTrees();
}
protected override Compilation CommonReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree? newTree)
{
return (Compilation)(object)ReplaceSyntaxTree(oldTree, newTree);
}
protected override Compilation CommonWithOptions(CompilationOptions options)
{
return (Compilation)(object)WithOptions((CSharpCompilationOptions)(object)options);
}
protected override Compilation CommonWithScriptCompilationInfo(ScriptCompilationInfo? info)
{
return (Compilation)(object)WithScriptCompilationInfo((CSharpScriptCompilationInfo)(object)info);
}
protected override bool CommonContainsSyntaxTree(SyntaxTree? syntaxTree)
{
return ContainsSyntaxTree(syntaxTree);
}
protected override ISymbol? CommonGetAssemblyOrModuleSymbol(MetadataReference reference)
{
return GetAssemblyOrModuleSymbol(reference).GetPublicSymbol();
}
protected override Compilation CommonClone()
{
return (Compilation)(object)Clone();
}
private protected override INamedTypeSymbolInternal CommonGetSpecialType(SpecialType specialType)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return (INamedTypeSymbolInternal)(object)GetSpecialType(specialType);
}
protected override INamespaceSymbol? CommonGetCompilationNamespace(INamespaceSymbol namespaceSymbol)
{
return GetCompilationNamespace(namespaceSymbol).GetPublicSymbol();
}
protected override INamedTypeSymbol? CommonGetTypeByMetadataName(string metadataName)
{
return GetTypeByMetadataName(metadataName).GetPublicSymbol();
}
protected override IArrayTypeSymbol CommonCreateArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation elementNullableAnnotation)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
return CreateArrayTypeSymbol(elementType.EnsureCSharpSymbolOrNull("elementType"), rank, elementNullableAnnotation.ToInternalAnnotation()).GetPublicSymbol();
}
protected override IPointerTypeSymbol CommonCreatePointerTypeSymbol(ITypeSymbol elementType)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
return CreatePointerTypeSymbol(elementType.EnsureCSharpSymbolOrNull("elementType"), elementType.NullableAnnotation.ToInternalAnnotation()).GetPublicSymbol();
}
protected override IFunctionPointerTypeSymbol CommonCreateFunctionPointerTypeSymbol(ITypeSymbol returnType, RefKind returnRefKind, ImmutableArray<ITypeSymbol> parameterTypes, ImmutableArray<RefKind> parameterRefKinds, SignatureCallingConvention callingConvention, ImmutableArray<INamedTypeSymbol> callingConventionTypes)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Invalid comparison between Unknown and I4
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Invalid comparison between Unknown and I4
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
if (returnType == null)
{
throw new ArgumentNullException("returnType");
}
if (parameterTypes.IsDefault)
{
throw new ArgumentNullException("parameterTypes");
}
for (int i = 0; i < parameterTypes.Length; i++)
{
if (parameterTypes[i] == null)
{
throw new ArgumentNullException(string.Format("{0}[{1}]", "parameterTypes", i));
}
}
if (parameterRefKinds.IsDefault)
{
throw new ArgumentNullException("parameterRefKinds");
}
if (parameterRefKinds.Length != parameterTypes.Length)
{
throw new ArgumentException(string.Format(CSharpResources.NotSameNumberParameterTypesAndRefKinds, parameterTypes.Length, parameterRefKinds.Length));
}
if ((int)returnRefKind == 2)
{
throw new ArgumentException(CSharpResources.OutIsNotValidForReturn);
}
if (callingConvention != SignatureCallingConvention.Unmanaged && !callingConventionTypes.IsDefaultOrEmpty)
{
throw new ArgumentException(string.Format(CSharpResources.CallingConventionTypesRequireUnmanaged, "callingConventionTypes", "callingConvention"));
}
if (!CallingConventionUtils.IsValid(callingConvention))
{
throw new ArgumentOutOfRangeException("callingConvention");
}
TypeWithAnnotations returnType2 = TypeWithAnnotations.Create(returnType.EnsureCSharpSymbolOrNull("returnType"), returnType.NullableAnnotation.ToInternalAnnotation());
ImmutableArray<TypeWithAnnotations> parameterTypes2 = ImmutableArrayExtensions.SelectAsArray<ITypeSymbol, TypeWithAnnotations>(parameterTypes, (Func<ITypeSymbol, TypeWithAnnotations>)((ITypeSymbol type) => TypeWithAnnotations.Create(type.EnsureCSharpSymbolOrNull("parameterTypes"), type.NullableAnnotation.ToInternalAnnotation())));
CallingConvention val = CallingConventionUtils.FromSignatureConvention(callingConvention);
ImmutableArray<CustomModifier> callingConventionModifiers = (((int)val == 9 && !callingConventionTypes.IsDefaultOrEmpty) ? ImmutableArrayExtensions.SelectAsArray<INamedTypeSymbol, CSharpCompilation, CustomModifier>(callingConventionTypes, (Func<INamedTypeSymbol, int, CSharpCompilation, CustomModifier>)((INamedTypeSymbol type, int index, CSharpCompilation @this) => getCustomModifierForType(type, @this, index)), this) : ImmutableArray<CustomModifier>.Empty);
return Microsoft.CodeAnalysis.CSharp.Symbols.FunctionPointerTypeSymbol.CreateFromParts(val, callingConventionModifiers, returnType2, returnRefKind, parameterTypes2, parameterRefKinds, this).GetPublicSymbol();
static CustomModifier getCustomModifierForType(INamedTypeSymbol type, CSharpCompilation @this, int index)
{
if (type == null)
{
throw new ArgumentNullException(string.Format("{0}[{1}]", "callingConventionTypes", index));
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol = type.EnsureCSharpSymbolOrNull(string.Format("{0}[{1}]", "callingConventionTypes", index));
if (!Microsoft.CodeAnalysis.CSharp.Symbols.FunctionPointerTypeSymbol.IsCallingConventionModifier(namedTypeSymbol) || @this.Assembly.CorLibrary != namedTypeSymbol.ContainingAssembly)
{
throw new ArgumentException(string.Format(CSharpResources.CallingConventionTypeIsInvalid, ((ISymbol)type).ToDisplayString((SymbolDisplayFormat)null)));
}
return CSharpCustomModifier.CreateOptional(namedTypeSymbol);
}
}
protected override INamedTypeSymbol CommonCreateNativeIntegerTypeSymbol(bool signed)
{
return CreateNativeIntegerTypeSymbol(signed).GetPublicSymbol();
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol CreateNativeIntegerTypeSymbol(bool signed)
{
return GetSpecialType((SpecialType)(signed ? 21 : 22)).AsNativeInteger();
}
protected override INamedTypeSymbol CommonCreateTupleTypeSymbol(ImmutableArray<ITypeSymbol> elementTypes, ImmutableArray<string?> elementNames, ImmutableArray<Location?> elementLocations, ImmutableArray<NullableAnnotation> elementNullableAnnotations)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
ArrayBuilder<TypeWithAnnotations> instance = ArrayBuilder<TypeWithAnnotations>.GetInstance(elementTypes.Length);
for (int i = 0; i < elementTypes.Length; i++)
{
ITypeSymbol val = elementTypes[i];
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol typeSymbol = val.EnsureCSharpSymbolOrNull(string.Format("{0}[{1}]", "elementTypes", i));
NullableAnnotation nullableAnnotation = (elementNullableAnnotations.IsDefault ? val.NullableAnnotation : elementNullableAnnotations[i]).ToInternalAnnotation();
instance.Add(TypeWithAnnotations.Create(typeSymbol, nullableAnnotation));
}
return Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol.CreateTuple(null, instance.ToImmutableAndFree(), elementLocations, elementNames, this, shouldCheckConstraints: false, includeNullability: false, default(ImmutableArray<bool>)).GetPublicSymbol();
}
protected override INamedTypeSymbol CommonCreateTupleTypeSymbol(INamedTypeSymbol underlyingType, ImmutableArray<string?> elementNames, ImmutableArray<Location?> elementLocations, ImmutableArray<NullableAnnotation> elementNullableAnnotations)
{
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol? namedTypeSymbol = underlyingType.EnsureCSharpSymbolOrNull("underlyingType");
if (!namedTypeSymbol.IsTupleTypeOfCardinality(out var tupleCardinality))
{
throw new ArgumentException(CodeAnalysisResources.TupleUnderlyingTypeMustBeTupleCompatible, "underlyingType");
}
elementNames = Compilation.CheckTupleElementNames(tupleCardinality, elementNames);
Compilation.CheckTupleElementLocations(tupleCardinality, elementLocations);
Compilation.CheckTupleElementNullableAnnotations(tupleCardinality, elementNullableAnnotations);
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol2 = Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol.CreateTuple(namedTypeSymbol, elementNames, default(ImmutableArray<bool>), elementLocations);
if (!elementNullableAnnotations.IsDefault)
{
namedTypeSymbol2 = namedTypeSymbol2.WithElementTypes(ImmutableArrayExtensions.ZipAsArray<TypeWithAnnotations, NullableAnnotation, TypeWithAnnotations>(namedTypeSymbol2.TupleElementTypesWithAnnotations, elementNullableAnnotations, (Func<TypeWithAnnotations, NullableAnnotation, TypeWithAnnotations>)((TypeWithAnnotations t, NullableAnnotation a) => TypeWithAnnotations.Create(t.Type, a.ToInternalAnnotation()))));
}
return namedTypeSymbol2.GetPublicSymbol();
}
protected override INamedTypeSymbol CommonCreateAnonymousTypeSymbol(ImmutableArray<ITypeSymbol> memberTypes, ImmutableArray<string> memberNames, ImmutableArray<Location> memberLocations, ImmutableArray<bool> memberIsReadOnly, ImmutableArray<NullableAnnotation> memberNullableAnnotations)
{
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
int i = 0;
for (int length = memberTypes.Length; i < length; i++)
{
memberTypes[i].EnsureCSharpSymbolOrNull(string.Format("{0}[{1}]", "memberTypes", i));
}
if (!memberIsReadOnly.IsDefault && memberIsReadOnly.Any((bool v) => !v))
{
throw new ArgumentException("Non-ReadOnly members are not supported in C# anonymous types.");
}
ArrayBuilder<AnonymousTypeField> instance = ArrayBuilder<AnonymousTypeField>.GetInstance();
int num = 0;
for (int length2 = memberTypes.Length; num < length2; num++)
{
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol symbol = memberTypes[num].GetSymbol();
string name = memberNames[num];
Location location = (Location)(memberLocations.IsDefault ? ((object)Location.None) : ((object)memberLocations[num]));
NullableAnnotation nullableAnnotation = (memberNullableAnnotations.IsDefault ? NullableAnnotation.Oblivious : memberNullableAnnotations[num].ToInternalAnnotation());
instance.Add(new AnonymousTypeField(name, location, TypeWithAnnotations.Create(symbol, nullableAnnotation), (RefKind)0, (ScopedKind)0));
}
AnonymousTypeDescriptor typeDescr = new AnonymousTypeDescriptor(instance.ToImmutableAndFree(), Location.None);
return AnonymousTypeManager.ConstructAnonymousTypeSymbol(typeDescr).GetPublicSymbol();
}
protected override IMethodSymbol CommonCreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol leftType, ITypeSymbol rightType)
{
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol csharpReturnType = returnType.EnsureCSharpSymbolOrNull("returnType");
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol csharpLeftType = leftType.EnsureCSharpSymbolOrNull("leftType");
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol csharpRightType = rightType.EnsureCSharpSymbolOrNull("rightType");
SyntaxKind syntaxKind = SyntaxFacts.GetOperatorKind(name);
if (syntaxKind == SyntaxKind.None)
{
throw new ArgumentException(string.Format(CodeAnalysisResources.BadBuiltInOps1, name), "name");
}
if (OperatorFacts.BinaryOperatorNameFromSyntaxKindIfAny(syntaxKind, SyntaxFacts.IsCheckedOperator(name)) != name)
{
throw new ArgumentException(string.Format(CodeAnalysisResources.BadBuiltInOps3, name), "name");
}
validateSignature();
return new SynthesizedIntrinsicOperatorSymbol(csharpLeftType, name, csharpRightType, csharpReturnType).GetPublicSymbol();
static bool isAllowedPointerArithmeticIntegralType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
SpecialType specialType = type.SpecialType;
if (specialType - 13 <= 3)
{
return true;
}
return false;
}
bool isReadOnlySpanOfByteType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Invalid comparison between Unknown and I4
if (IsReadOnlySpanType(type))
{
return (int)((Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].SpecialType == 10;
}
return false;
}
void validateSignature()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Invalid comparison between Unknown and I4
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Invalid comparison between Unknown and I4
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Invalid comparison between Unknown and I4
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Invalid comparison between Unknown and I4
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Invalid comparison between Unknown and I4
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Invalid comparison between Unknown and I4
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Invalid comparison between Unknown and I4
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Invalid comparison between Unknown and I4
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Invalid comparison between Unknown and I4
//IL_0528: Unknown result type (might be due to invalid IL or missing references)
//IL_052f: Invalid comparison between Unknown and I4
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_045f: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Invalid comparison between Unknown and I4
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_033e: Unknown result type (might be due to invalid IL or missing references)
if ((int)csharpReturnType.TypeKind == 4 || (int)csharpLeftType.TypeKind == 4 || (int)csharpRightType.TypeKind == 4)
{
return;
}
BinaryOperatorKind binaryOperatorKind = Binder.SyntaxKindToBinaryOperatorKind(SyntaxFacts.GetBinaryExpression(syntaxKind));
if ((int)csharpReturnType.SpecialType != 0 && (int)csharpLeftType.SpecialType != 0 && (int)csharpRightType.SpecialType != 0)
{
BinaryOperatorKind binaryOperatorKind2 = OverloadResolution.BinopEasyOut.OpKind(binaryOperatorKind, csharpLeftType, csharpRightType);
if (binaryOperatorKind2 != BinaryOperatorKind.Error)
{
BinaryOperatorSignature signature = builtInOperators.GetSignature(binaryOperatorKind2);
if (csharpReturnType.SpecialType == signature.ReturnType.SpecialType && csharpLeftType.SpecialType == signature.LeftType.SpecialType && csharpRightType.SpecialType == signature.RightType.SpecialType)
{
return;
}
}
}
bool flag = ((binaryOperatorKind == BinaryOperatorKind.Equal || binaryOperatorKind == BinaryOperatorKind.NotEqual) ? true : false);
if (flag && (int)csharpReturnType.SpecialType == 7)
{
SpecialType specialType = csharpLeftType.SpecialType;
SpecialType specialType2 = csharpRightType.SpecialType;
if ((int)specialType != 1)
{
if ((int)specialType == 4 && (int)specialType2 == 4)
{
goto IL_012b;
}
}
else if ((int)specialType2 == 1)
{
goto IL_012b;
}
flag = false;
goto IL_0131;
}
goto IL_0135;
IL_0131:
if (flag)
{
return;
}
goto IL_0135;
IL_012b:
flag = true;
goto IL_0131;
IL_0135:
if ((int)csharpLeftType.TypeKind == 3 && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpRightType, (TypeCompareKind)0))
{
flag = ((binaryOperatorKind == BinaryOperatorKind.Equal || binaryOperatorKind == BinaryOperatorKind.NotEqual) ? true : false);
if (flag && (int)csharpReturnType.SpecialType == 7)
{
return;
}
flag = ((binaryOperatorKind == BinaryOperatorKind.Addition || binaryOperatorKind == BinaryOperatorKind.Subtraction) ? true : false);
if (flag && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpReturnType, (TypeCompareKind)0))
{
return;
}
}
if (csharpLeftType.IsEnumType() || csharpRightType.IsEnumType())
{
switch (binaryOperatorKind)
{
case BinaryOperatorKind.Equal:
case BinaryOperatorKind.NotEqual:
case BinaryOperatorKind.GreaterThan:
case BinaryOperatorKind.LessThan:
case BinaryOperatorKind.GreaterThanOrEqual:
case BinaryOperatorKind.LessThanOrEqual:
flag = true;
break;
default:
flag = false;
break;
}
if (flag && (int)csharpReturnType.SpecialType == 7 && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpRightType, (TypeCompareKind)0))
{
return;
}
flag = ((binaryOperatorKind == BinaryOperatorKind.And || binaryOperatorKind == BinaryOperatorKind.Xor || binaryOperatorKind == BinaryOperatorKind.Or) ? true : false);
if (flag && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpRightType, (TypeCompareKind)0) && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpReturnType, csharpRightType, (TypeCompareKind)0))
{
return;
}
flag = ((binaryOperatorKind == BinaryOperatorKind.Addition || binaryOperatorKind == BinaryOperatorKind.Subtraction) ? true : false);
if ((flag && ((csharpLeftType.IsEnumType() && (SpecialType?)csharpRightType.SpecialType == csharpLeftType.GetEnumUnderlyingType()?.SpecialType && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpReturnType, (TypeCompareKind)0)) || (csharpRightType.IsEnumType() && (SpecialType?)csharpLeftType.SpecialType == csharpRightType.GetEnumUnderlyingType()?.SpecialType && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpRightType, csharpReturnType, (TypeCompareKind)0)))) || (binaryOperatorKind == BinaryOperatorKind.Subtraction && (SpecialType?)csharpReturnType.SpecialType == csharpLeftType.GetEnumUnderlyingType()?.SpecialType && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpRightType, (TypeCompareKind)0)))
{
return;
}
}
switch (binaryOperatorKind)
{
case BinaryOperatorKind.Equal:
case BinaryOperatorKind.NotEqual:
case BinaryOperatorKind.GreaterThan:
case BinaryOperatorKind.LessThan:
case BinaryOperatorKind.GreaterThanOrEqual:
case BinaryOperatorKind.LessThanOrEqual:
flag = true;
break;
default:
flag = false;
break;
}
if (flag && (int)csharpReturnType.SpecialType == 7 && csharpLeftType is Microsoft.CodeAnalysis.CSharp.Symbols.PointerTypeSymbol pointerTypeSymbol)
{
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol pointedAtType = pointerTypeSymbol.PointedAtType;
if ((object)pointedAtType != null && (int)pointedAtType.SpecialType == 6 && csharpRightType is Microsoft.CodeAnalysis.CSharp.Symbols.PointerTypeSymbol pointerTypeSymbol2)
{
pointedAtType = pointerTypeSymbol2.PointedAtType;
if ((object)pointedAtType != null && (int)pointedAtType.SpecialType == 6)
{
return;
}
}
}
if ((binaryOperatorKind == BinaryOperatorKind.Addition && csharpLeftType.IsPointerType() && isAllowedPointerArithmeticIntegralType(csharpRightType) && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpReturnType, (TypeCompareKind)0)) || (binaryOperatorKind == BinaryOperatorKind.Addition && csharpRightType.IsPointerType() && isAllowedPointerArithmeticIntegralType(csharpLeftType) && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpRightType, csharpReturnType, (TypeCompareKind)0)) || (binaryOperatorKind == BinaryOperatorKind.Subtraction && csharpLeftType.IsPointerType() && isAllowedPointerArithmeticIntegralType(csharpRightType) && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpReturnType, (TypeCompareKind)0)) || (binaryOperatorKind == BinaryOperatorKind.Subtraction && csharpLeftType.IsPointerType() && (int)csharpReturnType.SpecialType == 15 && Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpLeftType, csharpRightType, (TypeCompareKind)0)) || (binaryOperatorKind == BinaryOperatorKind.Addition && isReadOnlySpanOfByteType(csharpReturnType) && isReadOnlySpanOfByteType(csharpLeftType) && isReadOnlySpanOfByteType(csharpRightType)))
{
return;
}
throw new ArgumentException(string.Format(CodeAnalysisResources.BadBuiltInOps2, csharpReturnType.ToDisplayString() + " operator " + name + "(" + csharpLeftType.ToDisplayString() + ", " + csharpRightType.ToDisplayString() + ")"));
}
}
protected override IMethodSymbol CommonCreateBuiltinOperator(string name, ITypeSymbol returnType, ITypeSymbol operandType)
{
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol csharpReturnType = returnType.EnsureCSharpSymbolOrNull("returnType");
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol csharpOperandType = operandType.EnsureCSharpSymbolOrNull("operandType");
SyntaxKind syntaxKind = SyntaxFacts.GetOperatorKind(name);
bool flag = syntaxKind == SyntaxKind.None;
if (!flag)
{
string text = name;
bool flag2 = ((text == "op_True" || text == "op_False") ? true : false);
flag = flag2;
}
if (flag)
{
throw new ArgumentException(string.Format(CodeAnalysisResources.BadBuiltInOps1, name), "name");
}
if (OperatorFacts.UnaryOperatorNameFromSyntaxKindIfAny(syntaxKind, SyntaxFacts.IsCheckedOperator(name)) != name)
{
throw new ArgumentException(string.Format(CodeAnalysisResources.BadBuiltInOps3, name), "name");
}
validateSignature();
return new SynthesizedIntrinsicOperatorSymbol(csharpOperandType, name, csharpReturnType).GetPublicSymbol();
void validateSignature()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if ((int)csharpReturnType.TypeKind != 4 && (int)csharpOperandType.TypeKind != 4)
{
UnaryOperatorKind unaryOperatorKind = Binder.SyntaxKindToUnaryOperatorKind(SyntaxFacts.GetPrefixUnaryExpression(syntaxKind));
if ((int)csharpReturnType.SpecialType != 0 && (int)csharpOperandType.SpecialType != 0)
{
UnaryOperatorKind unaryOperatorKind2 = OverloadResolution.UnopEasyOut.OpKind(unaryOperatorKind, csharpOperandType);
if (unaryOperatorKind2 != UnaryOperatorKind.Error)
{
UnaryOperatorSignature signature = builtInOperators.GetSignature(unaryOperatorKind2);
if (csharpReturnType.SpecialType == signature.ReturnType.SpecialType && csharpOperandType.SpecialType == signature.OperandType.SpecialType)
{
return;
}
}
}
bool flag3 = csharpOperandType.IsEnumType();
if (flag3)
{
bool flag4 = ((unaryOperatorKind == UnaryOperatorKind.PrefixIncrement || unaryOperatorKind == UnaryOperatorKind.PrefixDecrement || unaryOperatorKind == UnaryOperatorKind.BitwiseComplement) ? true : false);
flag3 = flag4;
}
if (!flag3 || !Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpOperandType, csharpReturnType, (TypeCompareKind)0))
{
flag3 = csharpOperandType.IsPointerType();
if (flag3)
{
bool flag4 = ((unaryOperatorKind == UnaryOperatorKind.PrefixIncrement || unaryOperatorKind == UnaryOperatorKind.PrefixDecrement) ? true : false);
flag3 = flag4;
}
if (!flag3 || !Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(csharpOperandType, csharpReturnType, (TypeCompareKind)0))
{
throw new ArgumentException(string.Format(CodeAnalysisResources.BadBuiltInOps2, csharpReturnType.ToDisplayString() + " operator " + name + "(" + csharpOperandType.ToDisplayString() + ")"));
}
}
}
}
}
protected override IMethodSymbol? CommonGetEntryPoint(CancellationToken cancellationToken)
{
return GetEntryPoint(cancellationToken).GetPublicSymbol();
}
internal override int CompareSourceLocations(Location loc1, Location loc2)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
int num = ((Compilation)this).CompareSyntaxTreeOrdering(loc1.SourceTree, loc2.SourceTree);
if (num != 0)
{
return num;
}
TextSpan sourceSpan = loc1.SourceSpan;
int start = ((TextSpan)(ref sourceSpan)).Start;
sourceSpan = loc2.SourceSpan;
return start - ((TextSpan)(ref sourceSpan)).Start;
}
internal override int CompareSourceLocations(SyntaxReference loc1, SyntaxReference loc2)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
int num = ((Compilation)this).CompareSyntaxTreeOrdering(loc1.SyntaxTree, loc2.SyntaxTree);
if (num != 0)
{
return num;
}
TextSpan span = loc1.Span;
int start = ((TextSpan)(ref span)).Start;
span = loc2.Span;
return start - ((TextSpan)(ref span)).Start;
}
internal override int CompareSourceLocations(SyntaxNode loc1, SyntaxNode loc2)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
int num = ((Compilation)this).CompareSyntaxTreeOrdering(loc1.SyntaxTree, loc2.SyntaxTree);
if (num != 0)
{
return num;
}
TextSpan span = loc1.Span;
int start = ((TextSpan)(ref span)).Start;
span = loc2.Span;
return start - ((TextSpan)(ref span)).Start;
}
public override bool ContainsSymbolsWithName(Func<string, bool> predicate, SymbolFilter filter = (SymbolFilter)6, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (predicate == null)
{
throw new ArgumentNullException("predicate");
}
if ((int)filter == 0)
{
throw new ArgumentException(CSharpResources.NoNoneSearchCriteria, "filter");
}
return DeclarationTable.ContainsName(MergedRootDeclaration, predicate, filter, cancellationToken);
}
public override IEnumerable<ISymbol> GetSymbolsWithName(Func<string, bool> predicate, SymbolFilter filter = (SymbolFilter)6, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (predicate == null)
{
throw new ArgumentNullException("predicate");
}
if ((int)filter == 0)
{
throw new ArgumentException(CSharpResources.NoNoneSearchCriteria, "filter");
}
return new PredicateSymbolSearcher(this, filter, predicate, cancellationToken).GetSymbolsWithName().GetPublicSymbols();
}
public override bool ContainsSymbolsWithName(string name, SymbolFilter filter = (SymbolFilter)6, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (name == null)
{
throw new ArgumentNullException("name");
}
if ((int)filter == 0)
{
throw new ArgumentException(CSharpResources.NoNoneSearchCriteria, "filter");
}
return DeclarationTable.ContainsName(MergedRootDeclaration, name, filter, cancellationToken);
}
public override IEnumerable<ISymbol> GetSymbolsWithName(string name, SymbolFilter filter = (SymbolFilter)6, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return GetSymbolsWithNameCore(name, filter, cancellationToken).GetPublicSymbols();
}
internal IEnumerable<Symbol> GetSymbolsWithNameCore(string name, SymbolFilter filter = (SymbolFilter)6, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (name == null)
{
throw new ArgumentNullException("name");
}
if ((int)filter == 0)
{
throw new ArgumentException(CSharpResources.NoNoneSearchCriteria, "filter");
}
return new NameSymbolSearcher(this, filter, name, cancellationToken).GetSymbolsWithName();
}
internal bool HasDynamicEmitAttributes(BindingDiagnosticBag diagnostics, Location location)
{
if ((object)Binder.GetWellKnownTypeMember(this, (WellKnownMember)119, diagnostics, location) != null)
{
return (object)Binder.GetWellKnownTypeMember(this, (WellKnownMember)120, diagnostics, location) != null;
}
return false;
}
internal bool HasTupleNamesAttributes(BindingDiagnosticBag diagnostics, Location location)
{
return (object)Binder.GetWellKnownTypeMember(this, (WellKnownMember)352, diagnostics, location) != null;
}
internal bool CanEmitBoolean()
{
return CanEmitSpecialType((SpecialType)7);
}
internal bool CanEmitSpecialType(SpecialType type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
DiagnosticInfo diagnosticInfo = GetSpecialType(type).GetUseSiteInfo().DiagnosticInfo;
if (diagnosticInfo != null)
{
return (int)diagnosticInfo.Severity != 3;
}
return true;
}
internal bool ShouldEmitNativeIntegerAttributes()
{
return !Assembly.RuntimeSupportsNumericIntPtr;
}
internal bool ShouldEmitNullableAttributes(Symbol symbol)
{
if (symbol.ContainingModule != SourceModule)
{
return false;
}
if (!EmitNullablePublicOnly)
{
return true;
}
symbol = getExplicitAccessibilitySymbol(symbol);
if (!AccessCheck.IsEffectivelyPublicOrInternal(symbol, out var isInternal))
{
return false;
}
if (isInternal)
{
return SourceAssembly.InternalsAreVisible;
}
return true;
static Symbol getExplicitAccessibilitySymbol(Symbol containingSymbol)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected I4, but got Unknown
while (true)
{
SymbolKind kind = containingSymbol.Kind;
if ((int)kind != 5)
{
switch (kind - 13)
{
case 0:
case 2:
case 4:
break;
default:
return containingSymbol;
}
}
containingSymbol = containingSymbol.ContainingSymbol;
}
}
}
internal override AnalyzerDriver CreateAnalyzerDriver(ImmutableArray<DiagnosticAnalyzer> analyzers, AnalyzerManager analyzerManager, SeverityFilter severityFilter)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
Func<SyntaxNode, SyntaxKind> func = (SyntaxNode node) => node.Kind();
Func<SyntaxTrivia, bool> func2 = (SyntaxTrivia trivia) => trivia.Kind() == SyntaxKind.SingleLineCommentTrivia || trivia.Kind() == SyntaxKind.MultiLineCommentTrivia;
return (AnalyzerDriver)(object)new AnalyzerDriver<SyntaxKind>(analyzers, func, analyzerManager, severityFilter, func2);
}
internal void SymbolDeclaredEvent(Symbol symbol)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
((Compilation)this).EventQueue?.TryEnqueue((CompilationEvent)new SymbolDeclaredCompilationEvent((Compilation)(object)this, (ISymbolInternal)(object)symbol, (SemanticModel)null));
}
internal override void SerializePdbEmbeddedCompilationOptions(BlobBuilder builder)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
writeValue("language-version", LanguageVersion.ToDisplayString());
if (((CompilationOptions)Options).CheckOverflow)
{
writeValue("checked", ((CompilationOptions)Options).CheckOverflow.ToString());
}
if ((int)((CompilationOptions)Options).NullableContextOptions != 0)
{
writeValue("nullable", ((object)((CompilationOptions)Options).NullableContextOptions/*cast due to constrained. prefix*/).ToString());
}
if (Options.AllowUnsafe)
{
writeValue("unsafe", Options.AllowUnsafe.ToString());
}
ImmutableArray<string> preprocessorSymbols = GetPreprocessorSymbols();
if (preprocessorSymbols.Any())
{
writeValue("define", string.Join(",", preprocessorSymbols));
}
void writeValue(string key, string value)
{
builder.WriteUTF8(key);
builder.WriteByte(0);
builder.WriteUTF8(value);
builder.WriteByte(0);
}
}
private ImmutableArray<string> GetPreprocessorSymbols()
{
CSharpSyntaxTree cSharpSyntaxTree = (CSharpSyntaxTree)(object)SyntaxTrees.FirstOrDefault();
if (cSharpSyntaxTree == null)
{
return ImmutableArray<string>.Empty;
}
return ((ParseOptions)cSharpSyntaxTree.Options).PreprocessorSymbolNames.ToImmutableArray();
}
private protected override bool SupportsRuntimeCapabilityCore(RuntimeCapability capability)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return Assembly.SupportsRuntimeCapability(capability);
}
public override ImmutableArray<MetadataReference> GetUsedAssemblyReferences(CancellationToken cancellationToken = default(CancellationToken))
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> completeSetOfUsedAssemblies = GetCompleteSetOfUsedAssemblies(cancellationToken);
if (completeSetOfUsedAssemblies == null)
{
return ImmutableArray<MetadataReference>.Empty;
}
HashSet<MetadataReference> hashSet = new HashSet<MetadataReference>((IEqualityComparer<MetadataReference>?)ReferenceEqualityComparer.Instance);
ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>> mergedAssemblyReferencesMap = ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).MergedAssemblyReferencesMap;
foreach (MetadataReference reference in ((Compilation)this).References)
{
MetadataReferenceProperties properties = reference.Properties;
if ((int)((MetadataReferenceProperties)(ref properties)).Kind == 0)
{
Symbol referencedAssemblySymbol = ((CommonReferenceManager<CSharpCompilation, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)GetBoundReferenceManager()).GetReferencedAssemblySymbol(reference);
if ((object)referencedAssemblySymbol != null && completeSetOfUsedAssemblies.Contains((Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol)referencedAssemblySymbol) && hashSet.Add(reference) && mergedAssemblyReferencesMap.TryGetValue(reference, out var value))
{
ISetExtensions.AddAll<MetadataReference>((ISet<MetadataReference>)hashSet, value);
}
}
}
ArrayBuilder<MetadataReference> instance = ArrayBuilder<MetadataReference>.GetInstance(hashSet.Count);
foreach (MetadataReference reference2 in ((Compilation)this).References)
{
if (hashSet.Contains(reference2))
{
instance.Add(reference2);
}
}
return instance.ToImmutableAndFree();
}
private ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>? GetCompleteSetOfUsedAssemblies(CancellationToken cancellationToken)
{
if (!_usedAssemblyReferencesFrozen && !Volatile.Read(in _usedAssemblyReferencesFrozen))
{
BindingDiagnosticBag concurrentInstance = BindingDiagnosticBag.GetConcurrentInstance();
GetDiagnosticsWithoutFiltering((CompilationStage)1, includeEarlierStages: true, concurrentInstance, cancellationToken);
bool flag = ((BindingDiagnosticBag)concurrentInstance).HasAnyErrors();
if (!flag)
{
((BindingDiagnosticBag)concurrentInstance).DiagnosticBag.Clear();
GetDiagnosticsForAllMethodBodies(concurrentInstance, doLowering: true, cancellationToken);
flag = ((BindingDiagnosticBag)concurrentInstance).HasAnyErrors();
if (!flag)
{
AddUsedAssemblies(((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)concurrentInstance).DependenciesBag);
}
}
completeTheSetOfUsedAssemblies(flag, cancellationToken);
((BindingDiagnosticBag<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)(object)concurrentInstance).Free();
}
return _lazyUsedAssemblyReferences;
void addReferencedAssemblies(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assembly, bool includeMainModule, ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> stack)
{
for (int i = ((!includeMainModule) ? 1 : 0); i < assembly.Modules.Length; i++)
{
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Enumerator enumerator = assembly.Modules[i].ReferencedAssemblySymbols.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol current = enumerator.Current;
addUsedAssembly(current, stack);
}
}
}
void addUsedAssembly(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol dependency, ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> stack)
{
if (AddUsedAssembly(dependency))
{
ArrayBuilderExtensions.Push<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(stack, dependency);
}
}
void completeTheSetOfUsedAssemblies(bool seenErrors, CancellationToken cancellationToken2)
{
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
if (!_usedAssemblyReferencesFrozen && !Volatile.Read(in _usedAssemblyReferencesFrozen))
{
if (seenErrors)
{
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Enumerator enumerator = SourceModule.ReferencedAssemblySymbols.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol current = enumerator.Current;
AddUsedAssembly(current);
}
}
else
{
for (int i = 1; i < SourceAssembly.Modules.Length; i++)
{
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Enumerator enumerator = SourceAssembly.Modules[i].ReferencedAssemblySymbols.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol current2 = enumerator.Current;
AddUsedAssembly(current2);
}
}
if (_usedAssemblyReferencesFrozen || Volatile.Read(in _usedAssemblyReferencesFrozen))
{
return;
}
if (_lazyUsedAssemblyReferences != null)
{
lock (_lazyUsedAssemblyReferences)
{
if (_usedAssemblyReferencesFrozen || Volatile.Read(in _usedAssemblyReferencesFrozen))
{
return;
}
ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> instance = ArrayBuilder<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.GetInstance(_lazyUsedAssemblyReferences.Count);
instance.AddRange((IEnumerable<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>)_lazyUsedAssemblyReferences);
while (instance.Count != 0)
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assemblySymbol = ArrayBuilderExtensions.Pop<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(instance);
if (!(assemblySymbol is Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol sourceAssemblySymbol))
{
if (assemblySymbol is RetargetingAssemblySymbol retargetingAssemblySymbol)
{
ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> completeSetOfUsedAssemblies = retargetingAssemblySymbol.UnderlyingAssembly.DeclaringCompilation.GetCompleteSetOfUsedAssemblies(cancellationToken2);
if (completeSetOfUsedAssemblies != null)
{
ImmutableArray<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Enumerator enumerator = retargetingAssemblySymbol.UnderlyingAssembly.SourceModule.ReferencedAssemblySymbols.GetEnumerator();
while (enumerator.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol current3 = enumerator.Current;
if (!current3.IsLinked && completeSetOfUsedAssemblies.Contains(current3))
{
if (!((RetargetingModuleSymbol)retargetingAssemblySymbol.Modules[0]).RetargetingDefinitions(current3, out var to))
{
to = current3;
}
addUsedAssembly(to, instance);
}
}
}
addReferencedAssemblies(retargetingAssemblySymbol, includeMainModule: false, instance);
}
else
{
addReferencedAssemblies(assemblySymbol, includeMainModule: true, instance);
}
}
else
{
ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> completeSetOfUsedAssemblies = sourceAssemblySymbol.DeclaringCompilation.GetCompleteSetOfUsedAssemblies(cancellationToken2);
if (completeSetOfUsedAssemblies != null)
{
KeyEnumerator<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> enumerator2 = completeSetOfUsedAssemblies.GetEnumerator();
while (enumerator2.MoveNext())
{
Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol current4 = enumerator2.Current;
addUsedAssembly(current4, instance);
}
}
}
}
instance.Free();
}
}
if ((object)SourceAssembly.CorLibrary != null)
{
AddUsedAssembly(SourceAssembly.CorLibrary);
}
}
_usedAssemblyReferencesFrozen = true;
}
}
}
internal void AddUsedAssemblies(ICollection<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>? assemblies)
{
if (CollectionsExtensions.IsNullOrEmpty<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(assemblies))
{
return;
}
foreach (Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol assembly in assemblies)
{
AddUsedAssembly(assembly);
}
}
internal bool AddUsedAssembly(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol? assembly)
{
if ((object)assembly == null || assembly == SourceAssembly || assembly.IsMissing)
{
return false;
}
if (_lazyUsedAssemblyReferences == null)
{
Interlocked.CompareExchange(ref _lazyUsedAssemblyReferences, new ConcurrentSet<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>(), null);
}
return _lazyUsedAssemblyReferences.Add(assembly);
}
internal EmbeddableAttributes GetNeedsGeneratedAttributes()
{
_needsGeneratedAttributes_IsFrozen = true;
return (EmbeddableAttributes)_needsGeneratedAttributes;
}
private void SetNeedsGeneratedAttributes(EmbeddableAttributes attributes)
{
ThreadSafeFlagOperations.Set(ref _needsGeneratedAttributes, (int)attributes);
}
internal bool GetUsesNullableAttributes()
{
_needsGeneratedAttributes_IsFrozen = true;
return _usesNullableAttributes;
}
private void SetUsesNullableAttributes()
{
_usesNullableAttributes = true;
}
internal Symbol? GetWellKnownTypeMember(WellKnownMember member)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
if (((Compilation)this).IsMemberMissing(member))
{
return null;
}
if (_lazyWellKnownTypeMembers == null || (object)_lazyWellKnownTypeMembers[member] == Microsoft.CodeAnalysis.CSharp.Symbols.ErrorTypeSymbol.UnknownResultType)
{
if (_lazyWellKnownTypeMembers == null)
{
Symbol[] array = new Symbol[506];
for (int i = 0; i < array.Length; i++)
{
array[i] = Microsoft.CodeAnalysis.CSharp.Symbols.ErrorTypeSymbol.UnknownResultType;
}
Interlocked.CompareExchange(ref _lazyWellKnownTypeMembers, array, null);
}
MemberDescriptor descriptor = WellKnownMembers.GetDescriptor(member);
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol = ((descriptor.DeclaringTypeId <= 46) ? GetSpecialType((SpecialType)(sbyte)descriptor.DeclaringTypeId) : GetWellKnownType((WellKnownType)descriptor.DeclaringTypeId));
Symbol value = null;
if (!namedTypeSymbol.IsErrorType())
{
value = GetRuntimeMember(namedTypeSymbol, in descriptor, (SignatureComparer<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol>)(object)WellKnownMemberSignatureComparer, Assembly);
}
Interlocked.CompareExchange(ref _lazyWellKnownTypeMembers[member], value, Microsoft.CodeAnalysis.CSharp.Symbols.ErrorTypeSymbol.UnknownResultType);
}
return _lazyWellKnownTypeMembers[member];
}
internal Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol GetWellKnownType(WellKnownType type)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected I4, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Invalid comparison between Unknown and I4
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
bool ignoreCorLibraryDuplicatedTypes = Options.TopLevelBinderFlags.Includes(BinderFlags.IgnoreCorLibraryDuplicatedTypes);
int num = type - 47;
if (_lazyWellKnownTypes == null || (object)_lazyWellKnownTypes[num] == null)
{
if (_lazyWellKnownTypes == null)
{
Interlocked.CompareExchange(ref _lazyWellKnownTypes, new Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol[275], null);
}
string metadataName = WellKnownTypes.GetMetadataName(type);
DiagnosticBag instance = DiagnosticBag.GetInstance();
(Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol) conflicts = default((Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol));
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol namedTypeSymbol;
if (((Compilation)this).IsTypeMissing(type))
{
namedTypeSymbol = null;
}
else
{
DiagnosticBag warnings = (((int)type <= 252) ? instance : null);
namedTypeSymbol = Assembly.GetTypeByMetadataName(metadataName, includeReferences: true, isWellKnownType: true, out conflicts, useCLSCompliantNameArityEncoding: true, warnings, ignoreCorLibraryDuplicatedTypes);
}
if ((object)namedTypeSymbol == null)
{
MetadataTypeName fullName = MetadataTypeName.FromFullName(metadataName, true, -1);
namedTypeSymbol = ((!WellKnownTypes.IsValueTupleType(type)) ? new MissingMetadataTypeSymbol.TopLevel(Assembly.Modules[0], ref fullName, type) : new MissingMetadataTypeSymbol.TopLevel(errorInfo: (DiagnosticInfo?)(object)(((object)conflicts.Item1 != null) ? new CSDiagnosticInfo(ErrorCode.ERR_PredefinedValueTupleTypeAmbiguous3, ((MetadataTypeName)(ref fullName)).FullName, conflicts.Item1, conflicts.Item2) : new CSDiagnosticInfo(ErrorCode.ERR_PredefinedValueTupleTypeNotFound, ((MetadataTypeName)(ref fullName)).FullName)), module: Assembly.Modules[0], fullName: ref fullName, wellKnownType: type));
}
if ((object)Interlocked.CompareExchange(ref _lazyWellKnownTypes[num], namedTypeSymbol, null) == null)
{
AdditionalCodegenWarnings.AddRange(instance);
}
instance.Free();
}
return _lazyWellKnownTypes[num];
}
internal bool IsAttributeType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> useSiteInfo = CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol>.Discarded;
return IsEqualOrDerivedFromWellKnownClass(type, (WellKnownType)49, ref useSiteInfo);
}
internal override bool IsAttributeType(ITypeSymbol type)
{
return IsAttributeType(type.EnsureCSharpSymbolOrNull("type"));
}
internal bool IsExceptionType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, ref CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> useSiteInfo)
{
return IsEqualOrDerivedFromWellKnownClass(type, (WellKnownType)52, ref useSiteInfo);
}
internal bool IsReadOnlySpanType(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
return Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals(type.OriginalDefinition, GetWellKnownType((WellKnownType)276), (TypeCompareKind)0);
}
internal bool IsEqualOrDerivedFromWellKnownClass(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, WellKnownType wellKnownType, ref CompoundUseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> useSiteInfo)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if ((int)type.Kind != 11 || (int)type.TypeKind != 2)
{
return false;
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol wellKnownType2 = GetWellKnownType(wellKnownType);
if (!type.Equals(wellKnownType2, (TypeCompareKind)0))
{
return type.IsDerivedFrom(wellKnownType2, (TypeCompareKind)0, ref useSiteInfo);
}
return true;
}
internal override bool IsSystemTypeReference(ITypeSymbolInternal type)
{
return Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol.Equals((Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol)(object)type, GetWellKnownType((WellKnownType)61), (TypeCompareKind)0);
}
internal override ISymbolInternal? CommonGetWellKnownTypeMember(WellKnownMember member)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return (ISymbolInternal?)(object)GetWellKnownTypeMember(member);
}
internal override ITypeSymbolInternal CommonGetWellKnownType(WellKnownType wellknownType)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return (ITypeSymbolInternal)(object)GetWellKnownType(wellknownType);
}
internal static Symbol? GetRuntimeMember(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol> comparer, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol? accessWithinOpt)
{
return GetRuntimeMember(declaringType.GetMembers(descriptor.Name), in descriptor, comparer, accessWithinOpt);
}
internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol, Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol> comparer, Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol? accessWithinOpt)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected I4, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Invalid comparison between Unknown and I4
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Invalid comparison between Unknown and I4
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Invalid comparison between Unknown and I4
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Invalid comparison between Unknown and I4
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Invalid comparison between Unknown and I4
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Invalid comparison between Unknown and I4
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Invalid comparison between Unknown and I4
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Invalid comparison between Unknown and I4
MethodKind val = (MethodKind)10;
bool flag = (descriptor.Flags & 0x20) > 0;
Symbol symbol = null;
MemberFlags val2 = (MemberFlags)(descriptor.Flags & 0x1F);
SymbolKind val3;
switch (val2 - 1)
{
default:
if ((int)val2 != 8)
{
if ((int)val2 != 16)
{
goto case 2;
}
val3 = (SymbolKind)15;
break;
}
val3 = (SymbolKind)9;
val = (MethodKind)11;
break;
case 3:
val3 = (SymbolKind)9;
val = (MethodKind)1;
break;
case 0:
val3 = (SymbolKind)9;
break;
case 1:
val3 = (SymbolKind)6;
break;
case 2:
throw ExceptionUtilities.UnexpectedValue((object)descriptor.Flags);
}
ImmutableArray<Symbol>.Enumerator enumerator = members.GetEnumerator();
while (enumerator.MoveNext())
{
Symbol current = enumerator.Current;
if (!current.Name.Equals(descriptor.Name) || current.Kind != val3 || current.IsStatic != flag || ((int)current.DeclaredAccessibility != 6 && ((object)accessWithinOpt == null || !Symbol.IsSymbolAccessible(current, accessWithinOpt))))
{
continue;
}
if ((int)val3 != 6)
{
if ((int)val3 != 9)
{
if ((int)val3 != 15)
{
throw ExceptionUtilities.UnexpectedValue((object)val3);
}
Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol propertySymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.PropertySymbol)current;
if ((descriptor.Flags & 0x40) > 0 != (propertySymbol.IsVirtual || propertySymbol.IsOverride || propertySymbol.IsAbstract) || !comparer.MatchPropertySignature(propertySymbol, descriptor.Signature))
{
continue;
}
}
else
{
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol methodSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)current;
MethodKind val4 = methodSymbol.MethodKind;
if ((int)val4 == 2 || (int)val4 == 9)
{
val4 = (MethodKind)10;
}
if (methodSymbol.Arity != descriptor.Arity || val4 != val || (descriptor.Flags & 0x40) > 0 != (methodSymbol.IsVirtual || methodSymbol.IsOverride || methodSymbol.IsAbstract) || !comparer.MatchMethodSignature(methodSymbol, descriptor.Signature))
{
continue;
}
}
}
else if (!comparer.MatchFieldSignature((Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol)current, descriptor.Signature))
{
continue;
}
if ((object)symbol != null)
{
symbol = null;
break;
}
symbol = current;
}
return symbol;
}
internal SynthesizedAttributeData? TrySynthesizeAttribute(WellKnownMember constructor, ImmutableArray<TypedConstant> arguments = default(ImmutableArray<TypedConstant>), ImmutableArray<KeyValuePair<WellKnownMember, TypedConstant>> namedArguments = default(ImmutableArray<KeyValuePair<WellKnownMember, TypedConstant>>), bool isOptionalUse = false)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
UseSiteInfo<Microsoft.CodeAnalysis.CSharp.Symbols.AssemblySymbol> useSiteInfo;
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol methodSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)Binder.GetWellKnownTypeMember(this, constructor, out useSiteInfo, isOptional: true);
if ((object)methodSymbol == null)
{
return null;
}
if (arguments.IsDefault)
{
arguments = ImmutableArray<TypedConstant>.Empty;
}
ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments2;
if (namedArguments.IsDefault)
{
namedArguments2 = ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty;
}
else
{
ArrayBuilder<KeyValuePair<string, TypedConstant>> val = new ArrayBuilder<KeyValuePair<string, TypedConstant>>(namedArguments.Length);
ImmutableArray<KeyValuePair<WellKnownMember, TypedConstant>>.Enumerator enumerator = namedArguments.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair<WellKnownMember, TypedConstant> current = enumerator.Current;
Symbol wellKnownTypeMember = Binder.GetWellKnownTypeMember(this, current.Key, out useSiteInfo, isOptional: true);
if (wellKnownTypeMember == null || wellKnownTypeMember is Microsoft.CodeAnalysis.CSharp.Symbols.ErrorTypeSymbol)
{
return null;
}
val.Add(new KeyValuePair<string, TypedConstant>(wellKnownTypeMember.Name, current.Value));
}
namedArguments2 = val.ToImmutableAndFree();
}
return new SynthesizedAttributeData(methodSymbol, arguments, namedArguments2);
}
internal SynthesizedAttributeData? TrySynthesizeAttribute(SpecialMember constructor, bool isOptionalUse = false)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol methodSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol)GetSpecialTypeMember(constructor);
if ((object)methodSymbol == null)
{
return null;
}
return new SynthesizedAttributeData(methodSymbol, ImmutableArray<TypedConstant>.Empty, ImmutableArray<KeyValuePair<string, TypedConstant>>.Empty);
}
internal SynthesizedAttributeData? SynthesizeDecimalConstantAttribute(decimal value)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
bool flag = default(bool);
byte b = default(byte);
uint num = default(uint);
uint num2 = default(uint);
uint num3 = default(uint);
DecimalUtilities.GetBits(value, ref flag, ref b, ref num, ref num2, ref num3);
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol specialType = GetSpecialType((SpecialType)10);
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol specialType2 = GetSpecialType((SpecialType)14);
return TrySynthesizeAttribute((WellKnownMember)109, ImmutableArray.Create((TypedConstant[]?)(object)new TypedConstant[5]
{
new TypedConstant((ITypeSymbolInternal)(object)specialType, (TypedConstantKind)1, (object)b),
new TypedConstant((ITypeSymbolInternal)(object)specialType, (TypedConstantKind)1, (object)(byte)(flag ? 128u : 0u)),
new TypedConstant((ITypeSymbolInternal)(object)specialType2, (TypedConstantKind)1, (object)num3),
new TypedConstant((ITypeSymbolInternal)(object)specialType2, (TypedConstantKind)1, (object)num2),
new TypedConstant((ITypeSymbolInternal)(object)specialType2, (TypedConstantKind)1, (object)num)
}));
}
internal SynthesizedAttributeData? SynthesizeDateTimeConstantAttribute(DateTime value)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
TypedConstant item = default(TypedConstant);
((TypedConstant)(ref item))._002Ector((ITypeSymbolInternal)(object)GetSpecialType((SpecialType)15), (TypedConstantKind)1, (object)value.Ticks);
return TrySynthesizeAttribute((WellKnownMember)108, ImmutableArray.Create<TypedConstant>(item));
}
internal SynthesizedAttributeData? SynthesizeDebuggerBrowsableNeverAttribute()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if ((int)((CompilationOptions)Options).OptimizationLevel != 0)
{
return null;
}
return TrySynthesizeAttribute((WellKnownMember)71, ImmutableArray.Create<TypedConstant>(new TypedConstant((ITypeSymbolInternal)(object)GetWellKnownType((WellKnownType)197), (TypedConstantKind)2, (object)DebuggerBrowsableState.Never)));
}
internal SynthesizedAttributeData? SynthesizeDebuggerStepThroughAttribute()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
if ((int)((CompilationOptions)Options).OptimizationLevel != 0)
{
return null;
}
return TrySynthesizeAttribute((WellKnownMember)72);
}
private void EnsureEmbeddableAttributeExists(EmbeddableAttributes attribute, BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
if (CheckIfAttributeShouldBeEmbedded(attribute, diagnostics, location) && modifyCompilation)
{
SetNeedsGeneratedAttributes(attribute);
}
if ((attribute & (EmbeddableAttributes.NullableAttribute | EmbeddableAttributes.NullableContextAttribute)) != 0 && modifyCompilation)
{
SetUsesNullableAttributes();
}
}
internal void EnsureIsReadOnlyAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.IsReadOnlyAttribute, diagnostics, location, modifyCompilation);
}
internal void EnsureRequiresLocationAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.RequiresLocationAttribute, diagnostics, location, modifyCompilation);
}
internal void EnsureIsByRefLikeAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.IsByRefLikeAttribute, diagnostics, location, modifyCompilation);
}
internal void EnsureIsUnmanagedAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.IsUnmanagedAttribute, diagnostics, location, modifyCompilation);
}
internal void EnsureNullableAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.NullableAttribute, diagnostics, location, modifyCompilation);
}
internal void EnsureNullableContextAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.NullableContextAttribute, diagnostics, location, modifyCompilation);
}
internal void EnsureNativeIntegerAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.NativeIntegerAttribute, diagnostics, location, modifyCompilation);
}
internal void EnsureScopedRefAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
{
EnsureEmbeddableAttributeExists(EmbeddableAttributes.ScopedRefAttribute, diagnostics, location, modifyCompilation);
}
internal bool CheckIfAttributeShouldBeEmbedded(EmbeddableAttributes attribute, BindingDiagnosticBag? diagnosticsOpt, Location locationOpt)
{
return attribute switch
{
EmbeddableAttributes.IsReadOnlyAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)270, (WellKnownMember)394),
EmbeddableAttributes.IsByRefLikeAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)272, (WellKnownMember)396),
EmbeddableAttributes.IsUnmanagedAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)278, (WellKnownMember)409),
EmbeddableAttributes.NullableAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)266, (WellKnownMember)389, (WellKnownMember)390),
EmbeddableAttributes.NullableContextAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)267, (WellKnownMember)391),
EmbeddableAttributes.NullablePublicOnlyAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)268, (WellKnownMember)392),
EmbeddableAttributes.NativeIntegerAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)303, (WellKnownMember)462, (WellKnownMember)463),
EmbeddableAttributes.ScopedRefAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)311, (WellKnownMember)471),
EmbeddableAttributes.RefSafetyRulesAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)312, (WellKnownMember)472),
EmbeddableAttributes.RequiresLocationAttribute => CheckIfAttributeShouldBeEmbedded(diagnosticsOpt, locationOpt, (WellKnownType)271, (WellKnownMember)395),
_ => throw ExceptionUtilities.UnexpectedValue((object)attribute),
};
}
private bool CheckIfAttributeShouldBeEmbedded(BindingDiagnosticBag? diagnosticsOpt, Location? locationOpt, WellKnownType attributeType, WellKnownMember attributeCtor, WellKnownMember? secondAttributeCtor = null)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol wellKnownType = GetWellKnownType(attributeType);
if (wellKnownType is MissingMetadataTypeSymbol)
{
if ((int)((CompilationOptions)Options).OutputKind != 3)
{
return true;
}
if (diagnosticsOpt != null)
{
Binder.ReportUseSite(wellKnownType, diagnosticsOpt, locationOpt);
}
}
else if (diagnosticsOpt != null && Binder.GetWellKnownTypeMember(this, attributeCtor, diagnosticsOpt, locationOpt) != null && secondAttributeCtor.HasValue)
{
Binder.GetWellKnownTypeMember(this, secondAttributeCtor.Value, diagnosticsOpt, locationOpt);
}
return false;
}
internal SynthesizedAttributeData? SynthesizeDebuggableAttribute()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
if (GetWellKnownType((WellKnownType)198) is MissingMetadataTypeSymbol)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol wellKnownType = GetWellKnownType((WellKnownType)199);
if (wellKnownType is MissingMetadataTypeSymbol)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol fieldSymbol = (Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol)GetWellKnownTypeMember((WellKnownMember)77);
if ((object)fieldSymbol == null || !fieldSymbol.HasConstantValue)
{
return null;
}
int num = fieldSymbol.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false).Int32Value;
if ((int)((CompilationOptions)_options).OptimizationLevel == 0)
{
Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol fieldSymbol2 = (Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol)GetWellKnownTypeMember((WellKnownMember)74);
if ((object)fieldSymbol2 == null || !fieldSymbol2.HasConstantValue)
{
return null;
}
Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol fieldSymbol3 = (Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol)GetWellKnownTypeMember((WellKnownMember)75);
if ((object)fieldSymbol3 == null || !fieldSymbol3.HasConstantValue)
{
return null;
}
num |= fieldSymbol2.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false).Int32Value;
num |= fieldSymbol3.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false).Int32Value;
}
if (((CompilationOptions)_options).EnableEditAndContinue)
{
Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol fieldSymbol4 = (Microsoft.CodeAnalysis.CSharp.Symbols.FieldSymbol)GetWellKnownTypeMember((WellKnownMember)76);
if ((object)fieldSymbol4 == null || !fieldSymbol4.HasConstantValue)
{
return null;
}
num |= fieldSymbol4.GetConstantValue(ConstantFieldsInProgress.Empty, earlyDecodingWellKnownAttributes: false).Int32Value;
}
TypedConstant item = default(TypedConstant);
((TypedConstant)(ref item))._002Ector((ITypeSymbolInternal)(object)wellKnownType, (TypedConstantKind)2, (object)num);
return TrySynthesizeAttribute((WellKnownMember)73, ImmutableArray.Create<TypedConstant>(item));
}
internal SynthesizedAttributeData? SynthesizeDynamicAttribute(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type, int customModifiersCount, RefKind refKindOpt = (RefKind)0)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (type.IsDynamic() && (int)refKindOpt == 0 && customModifiersCount == 0)
{
return TrySynthesizeAttribute((WellKnownMember)119);
}
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol specialType = GetSpecialType((SpecialType)7);
ImmutableArray<TypedConstant> immutableArray = DynamicTransformsEncoder.Encode(type, refKindOpt, customModifiersCount, specialType);
ImmutableArray<TypedConstant> arguments = ImmutableArray.Create<TypedConstant>(new TypedConstant((ITypeSymbolInternal)(object)Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol.CreateSZArray(specialType.ContainingAssembly, TypeWithAnnotations.Create(specialType)), immutableArray));
return TrySynthesizeAttribute((WellKnownMember)120, arguments);
}
internal SynthesizedAttributeData? SynthesizeTupleNamesAttribute(Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol type)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol specialType = GetSpecialType((SpecialType)20);
ImmutableArray<TypedConstant> immutableArray = TupleNamesEncoder.Encode(type, specialType);
ImmutableArray<TypedConstant> arguments = ImmutableArray.Create<TypedConstant>(new TypedConstant((ITypeSymbolInternal)(object)Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol.CreateSZArray(specialType.ContainingAssembly, TypeWithAnnotations.Create(specialType)), immutableArray));
return TrySynthesizeAttribute((WellKnownMember)352, arguments);
}
internal SynthesizedAttributeData? SynthesizeAttributeUsageAttribute(AttributeTargets targets, bool allowMultiple, bool inherited)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol wellKnownType = GetWellKnownType((WellKnownType)281);
Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol specialType = GetSpecialType((SpecialType)7);
ImmutableArray<TypedConstant> arguments = ImmutableArray.Create<TypedConstant>(new TypedConstant((ITypeSymbolInternal)(object)wellKnownType, (TypedConstantKind)2, (object)targets));
ImmutableArray<KeyValuePair<WellKnownMember, TypedConstant>> namedArguments = ImmutableArray.Create(new KeyValuePair<WellKnownMember, TypedConstant>((WellKnownMember)61, new TypedConstant((ITypeSymbolInternal)(object)specialType, (TypedConstantKind)1, (object)allowMultiple)), new KeyValuePair<WellKnownMember, TypedConstant>((WellKnownMember)62, new TypedConstant((ITypeSymbolInternal)(object)specialType, (TypedConstantKind)1, (object)inherited)));
return TrySynthesizeAttribute((WellKnownMember)60, arguments, namedArguments);
}
}