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

2196 lines
86 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp;
internal abstract class MemberSemanticModel : CSharpSemanticModel
{
internal class IncrementalBinder : Binder
{
private readonly MemberSemanticModel _semanticModel;
internal IncrementalBinder(MemberSemanticModel semanticModel, Binder next)
: base(next)
{
_semanticModel = semanticModel;
}
internal override Binder GetBinder(SyntaxNode node)
{
Binder binder = base.Next.GetBinder(node);
if (binder != null)
{
return new IncrementalBinder(_semanticModel, binder.WithAdditionalFlags(BinderFlags.SemanticModel));
}
return null;
}
public override BoundStatement BindStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
{
if (node.SyntaxTree == _semanticModel.SyntaxTree)
{
BoundStatement boundStatement = _semanticModel.GuardedGetSynthesizedStatementFromMap(node);
if (boundStatement != null)
{
return boundStatement;
}
BoundNode boundNode = TryGetBoundNodeFromMap(node);
if (boundNode != null)
{
return (BoundStatement)boundNode;
}
}
BoundStatement boundStatement2 = base.BindStatement(node, diagnostics);
if (boundStatement2.WasCompilerGenerated && node.SyntaxTree == _semanticModel.SyntaxTree)
{
_semanticModel.GuardedAddSynthesizedStatementToMap(node, boundStatement2);
}
return boundStatement2;
}
internal override BoundBlock BindEmbeddedBlock(BlockSyntax node, BindingDiagnosticBag diagnostics)
{
BoundBlock boundBlock = (BoundBlock)TryGetBoundNodeFromMap(node);
if (boundBlock != null)
{
return boundBlock;
}
return base.BindEmbeddedBlock(node, diagnostics);
}
private BoundNode TryGetBoundNodeFromMap(CSharpSyntaxNode node)
{
//IL_001a: 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)
if (node.SyntaxTree == _semanticModel.SyntaxTree)
{
OneOrMany<BoundNode> val = _semanticModel.GuardedGetBoundNodesFromMap(node);
if (!val.IsEmpty)
{
return val[0];
}
}
return null;
}
public override BoundNode BindMethodBody(CSharpSyntaxNode node, BindingDiagnosticBag diagnostics)
{
BoundNode boundNode = TryGetBoundNodeFromMap(node);
if (boundNode != null)
{
return boundNode;
}
return base.BindMethodBody(node, diagnostics);
}
internal override BoundExpressionStatement BindConstructorInitializer(ConstructorInitializerSyntax node, BindingDiagnosticBag diagnostics)
{
return ((BoundExpressionStatement)TryGetBoundNodeFromMap(node)) ?? base.BindConstructorInitializer(node, diagnostics);
}
internal override BoundExpressionStatement BindConstructorInitializer(PrimaryConstructorBaseTypeSyntax node, BindingDiagnosticBag diagnostics)
{
return ((BoundExpressionStatement)TryGetBoundNodeFromMap(node)) ?? base.BindConstructorInitializer(node, diagnostics);
}
internal override BoundBlock BindExpressionBodyAsBlock(ArrowExpressionClauseSyntax node, BindingDiagnosticBag diagnostics)
{
BoundBlock boundBlock = (BoundBlock)TryGetBoundNodeFromMap(node);
if (boundBlock != null)
{
return boundBlock;
}
return base.BindExpressionBodyAsBlock(node, diagnostics);
}
}
internal sealed class MemberSemanticBindingCounter
{
internal int BindCount;
}
protected sealed class NodeMapBuilder : BoundTreeWalkerWithStackGuard
{
private readonly OrderPreservingMultiDictionary<SyntaxNode, BoundNode> _map;
private readonly SyntaxTree _tree;
private readonly SyntaxNode _thisSyntaxNodeOnly;
private NodeMapBuilder(OrderPreservingMultiDictionary<SyntaxNode, BoundNode> map, SyntaxTree tree, SyntaxNode thisSyntaxNodeOnly)
{
_map = map;
_tree = tree;
_thisSyntaxNodeOnly = thisSyntaxNodeOnly;
}
public static void AddToMap(BoundNode root, Dictionary<SyntaxNode, OneOrMany<BoundNode>> map, SyntaxTree tree, SyntaxNode node = null)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (root == null || map.ContainsKey(root.Syntax))
{
return;
}
OrderPreservingMultiDictionary<SyntaxNode, BoundNode> instance = OrderPreservingMultiDictionary<SyntaxNode, BoundNode>.GetInstance();
new NodeMapBuilder(instance, tree, node).Visit(root);
foreach (CSharpSyntaxNode key in instance.Keys)
{
if (!map.ContainsKey((SyntaxNode)(object)key))
{
map[(SyntaxNode)(object)key] = instance.GetAsOneOrMany((SyntaxNode)(object)key);
}
}
instance.Free();
}
public override BoundNode Visit(BoundNode node)
{
if (node == null || node.SyntaxTree != _tree)
{
return null;
}
BoundNode boundNode = node;
if (node.Kind == BoundKind.UnboundLambda)
{
boundNode = ((UnboundLambda)node).BindForErrorRecovery();
}
if (ShouldAddNode(boundNode))
{
_map.Add(boundNode.Syntax, boundNode);
}
if (boundNode is BoundBinaryOperator boundBinaryOperator)
{
ArrayBuilder<BoundExpression> instance = ArrayBuilder<BoundExpression>.GetInstance();
ArrayBuilderExtensions.Push<BoundExpression>(instance, boundBinaryOperator.Right);
boundNode = boundBinaryOperator.Left;
for (BoundBinaryOperator boundBinaryOperator2 = boundNode as BoundBinaryOperator; boundBinaryOperator2 != null; boundBinaryOperator2 = boundNode as BoundBinaryOperator)
{
if (ShouldAddNode(boundBinaryOperator2))
{
_map.Add(boundBinaryOperator2.Syntax, (BoundNode)boundBinaryOperator2);
}
ArrayBuilderExtensions.Push<BoundExpression>(instance, boundBinaryOperator2.Right);
boundNode = boundBinaryOperator2.Left;
}
Visit(boundNode);
while (instance.Count > 0)
{
Visit(ArrayBuilderExtensions.Pop<BoundExpression>(instance));
}
instance.Free();
}
else
{
base.Visit(boundNode);
}
return null;
}
private bool ShouldAddNode(BoundNode currentBoundNode)
{
if (currentBoundNode.WasCompilerGenerated)
{
return false;
}
if (_thisSyntaxNodeOnly != null && currentBoundNode.Syntax != _thisSyntaxNodeOnly)
{
return false;
}
return true;
}
public override BoundNode VisitQueryClause(BoundQueryClause node)
{
Visit(node.Value);
VisitUnoptimizedForm(node);
return null;
}
public override BoundNode VisitRangeVariable(BoundRangeVariable node)
{
return null;
}
public override BoundNode VisitAwaitableInfo(BoundAwaitableInfo node)
{
return null;
}
public override BoundNode VisitConstructorMethodBody(BoundConstructorMethodBody node)
{
if (node.Syntax != node.Initializer?.Syntax)
{
Visit(node.Initializer);
}
Visit(node.BlockBody);
Visit(node.ExpressionBody);
return null;
}
public override BoundNode VisitBinaryOperator(BoundBinaryOperator node)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.NodeMapBuilder.cs", 286);
}
protected override bool ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException()
{
return false;
}
}
internal sealed class SpeculativeMemberSemanticModel : MemberSemanticModel
{
public SpeculativeMemberSemanticModel(PublicSemanticModel containingPublicSemanticModel, Symbol owner, TypeSyntax root, Binder rootBinder, ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt)
: base(root, owner, rootBinder, containingPublicSemanticModel, parentRemappedSymbolsOpt)
{
}
protected override NullableWalker.SnapshotManager GetSnapshotManager()
{
return ((SpeculativeSemanticModelWithMemberModel)_containingPublicSemanticModel).ParentSnapshotManagerOpt;
}
protected override BoundNode RewriteNullableBoundNodesWithSnapshots(BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots, out NullableWalker.SnapshotManager snapshotManager, ref ImmutableDictionary<Symbol, Symbol> remappedSymbols)
{
return NullableWalker.AnalyzeAndRewrite(Compilation, base.MemberSymbol as MethodSymbol, boundRoot, binder, null, diagnostics, createSnapshots: false, out snapshotManager, ref remappedSymbols);
}
protected override void AnalyzeBoundNodeNullability(BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots)
{
NullableWalker.AnalyzeWithoutRewrite(Compilation, base.MemberSymbol as MethodSymbol, boundRoot, binder, diagnostics, createSnapshots);
}
protected override bool IsNullableAnalysisEnabled()
{
return ((SyntaxTreeSemanticModel)_containingPublicSemanticModel.ParentModel).IsNullableAnalysisEnabledAtSpeculativePosition(((SemanticModel)_containingPublicSemanticModel).OriginalPositionForSpeculation, (SyntaxNode)(object)Root);
}
internal override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, ConstructorInitializerSyntax constructorInitializer, out PublicSemanticModel speculativeModel)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.SpeculativeMemberSemanticModel.cs", 67);
}
internal override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, PrimaryConstructorBaseTypeSyntax constructorInitializer, out PublicSemanticModel speculativeModel)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.SpeculativeMemberSemanticModel.cs", 72);
}
internal override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, EqualsValueClauseSyntax initializer, out PublicSemanticModel speculativeModel)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.SpeculativeMemberSemanticModel.cs", 77);
}
internal override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, ArrowExpressionClauseSyntax expressionBody, out PublicSemanticModel speculativeModel)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.SpeculativeMemberSemanticModel.cs", 82);
}
internal override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, StatementSyntax statement, out PublicSemanticModel speculativeModel)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.SpeculativeMemberSemanticModel.cs", 87);
}
internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, BaseMethodDeclarationSyntax method, out PublicSemanticModel speculativeModel)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.SpeculativeMemberSemanticModel.cs", 92);
}
internal override bool TryGetSpeculativeSemanticModelForMethodBodyCore(SyntaxTreeSemanticModel parentModel, int position, AccessorDeclarationSyntax accessor, out PublicSemanticModel speculativeModel)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.SpeculativeMemberSemanticModel.cs", 97);
}
}
private readonly Symbol _memberSymbol;
private readonly CSharpSyntaxNode _root;
private readonly ReaderWriterLockSlim _nodeMapLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
private readonly Dictionary<SyntaxNode, OneOrMany<BoundNode>> _guardedBoundNodeMap = new Dictionary<SyntaxNode, OneOrMany<BoundNode>>();
private readonly Dictionary<SyntaxNode, IOperation> _guardedIOperationNodeMap = new Dictionary<SyntaxNode, IOperation>();
private Dictionary<SyntaxNode, BoundStatement> _lazyGuardedSynthesizedStatementsMap;
private NullableWalker.SnapshotManager _lazySnapshotManager;
private ImmutableDictionary<Symbol, Symbol> _lazyRemappedSymbols;
private readonly ImmutableDictionary<Symbol, Symbol> _parentRemappedSymbolsOpt;
internal readonly Binder RootBinder;
private readonly PublicSemanticModel _containingPublicSemanticModel;
private readonly Lazy<CSharpOperationFactory> _operationFactory;
public override CSharpCompilation Compilation => _containingPublicSemanticModel.Compilation;
internal override CSharpSyntaxNode Root => _root;
internal Symbol MemberSymbol => _memberSymbol;
public sealed override bool IsSpeculativeSemanticModel => ((SemanticModel)_containingPublicSemanticModel).IsSpeculativeSemanticModel;
public sealed override bool IgnoresAccessibility => ((SemanticModel)_containingPublicSemanticModel).IgnoresAccessibility;
public sealed override int OriginalPositionForSpeculation
{
get
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs", 113);
}
}
public sealed override CSharpSemanticModel ParentModel
{
get
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs", 123);
}
}
internal sealed override SemanticModel ContainingPublicModelOrSelf => (SemanticModel)(object)_containingPublicSemanticModel;
public override SyntaxTree SyntaxTree => _root.SyntaxTree;
protected MemberSemanticModel(CSharpSyntaxNode root, Symbol memberSymbol, Binder rootBinder, PublicSemanticModel containingPublicSemanticModel, ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt)
{
_root = root;
_memberSymbol = memberSymbol;
_containingPublicSemanticModel = containingPublicSemanticModel;
_parentRemappedSymbolsOpt = parentRemappedSymbolsOpt;
RootBinder = rootBinder.WithAdditionalFlags(GetSemanticModelBinderFlags());
_operationFactory = new Lazy<CSharpOperationFactory>(() => new CSharpOperationFactory((SemanticModel)(object)this));
}
internal override MemberSemanticModel GetMemberModel(SyntaxNode node)
{
if (!IsInTree(node))
{
return null;
}
return this;
}
protected virtual NullableWalker.SnapshotManager GetSnapshotManager()
{
EnsureNullabilityAnalysisPerformedIfNecessary();
return _lazySnapshotManager;
}
internal ImmutableDictionary<Symbol, Symbol> GetRemappedSymbols()
{
EnsureNullabilityAnalysisPerformedIfNecessary();
return _lazyRemappedSymbols;
}
internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, TypeSyntax type, SpeculativeBindingOption bindingOption, out PublicSemanticModel speculativeModel)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
ExpressionSyntax standaloneExpression = SyntaxFactory.GetStandaloneExpression(type);
Binder speculativeBinder = GetSpeculativeBinder(position, standaloneExpression, bindingOption);
if (speculativeBinder != null)
{
speculativeModel = new SpeculativeSemanticModelWithMemberModel(parentModel, position, _memberSymbol, type, speculativeBinder, GetRemappedSymbols(), GetSnapshotManager());
return true;
}
speculativeModel = null;
return false;
}
internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, CrefSyntax crefSyntax, out PublicSemanticModel speculativeModel)
{
speculativeModel = null;
return false;
}
internal override BoundExpression GetSpeculativelyBoundExpression(int position, ExpressionSyntax expression, SpeculativeBindingOption bindingOption, out Binder binder, out ImmutableArray<Symbol> crefSymbols)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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 (expression == null)
{
throw new ArgumentNullException("expression");
}
if ((int)bindingOption == 0)
{
NullableWalker.SnapshotManager snapshotManager = GetSnapshotManager();
if (snapshotManager != null)
{
crefSymbols = default(ImmutableArray<Symbol>);
position = CheckAndAdjustPosition(position);
expression = SyntaxFactory.GetStandaloneExpression(expression);
binder = GetSpeculativeBinder(position, expression, bindingOption);
BoundExpression node = binder.BindExpression(expression, BindingDiagnosticBag.Discarded);
ImmutableDictionary<Symbol, Symbol> remappedSymbols = null;
NullableWalker.SnapshotManager newSnapshots;
return (BoundExpression)NullableWalker.AnalyzeAndRewriteSpeculation(position, node, binder, snapshotManager, out newSnapshots, ref remappedSymbols);
}
}
return GetSpeculativelyBoundExpressionWithoutNullability(position, expression, bindingOption, out binder, out crefSymbols);
}
private Binder GetEnclosingBinderInternalWithinRoot(SyntaxNode node, int position)
{
return GetEnclosingBinderInternalWithinRoot(node, position, RootBinder, (SyntaxNode)(object)_root).WithAdditionalFlags(GetSemanticModelBinderFlags());
}
private static Binder GetEnclosingBinderInternalWithinRoot(SyntaxNode node, int position, Binder rootBinder, SyntaxNode root)
{
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
if (node == root)
{
return rootBinder.GetBinder(node) ?? rootBinder;
}
ExpressionSyntax expressionSyntax = null;
LocalFunctionStatementSyntax localFunctionStatementSyntax = null;
Binder binder = null;
SyntaxNode val = node;
while (binder == null)
{
StatementSyntax statementSyntax = val as StatementSyntax;
SyntaxKind syntaxKind = val.Kind();
if (statementSyntax != null)
{
if (LookupPosition.IsInStatementScope(position, statementSyntax))
{
binder = rootBinder.GetBinder(val);
if (binder != null)
{
binder = AdjustBinderForPositionWithinStatement(position, binder, statementSyntax);
}
else if (syntaxKind == SyntaxKind.LocalFunctionStatement)
{
LocalFunctionStatementSyntax localFunctionStatementSyntax2 = (LocalFunctionStatementSyntax)statementSyntax;
if (LookupPosition.IsInLocalFunctionTypeParameterScope(position, localFunctionStatementSyntax2))
{
localFunctionStatementSyntax = localFunctionStatementSyntax2;
}
}
}
}
else
{
switch (syntaxKind)
{
case SyntaxKind.CatchClause:
if (LookupPosition.IsInCatchBlockScope(position, (CatchClauseSyntax)(object)val))
{
binder = rootBinder.GetBinder(val);
}
break;
case SyntaxKind.CatchFilterClause:
if (LookupPosition.IsInCatchFilterScope(position, (CatchFilterClauseSyntax)(object)val))
{
binder = rootBinder.GetBinder(val);
}
break;
default:
{
if (val.IsAnonymousFunction())
{
if (LookupPosition.IsInAnonymousFunctionOrQuery(position, val))
{
binder = rootBinder.GetBinder((SyntaxNode)(object)val.AnonymousFunctionBody());
}
break;
}
TypeOfExpressionSyntax typeOfExpressionSyntax;
if (syntaxKind == SyntaxKind.TypeOfExpression && expressionSyntax == null && LookupPosition.IsBetweenTokens(position, (typeOfExpressionSyntax = (TypeOfExpressionSyntax)(object)val).OpenParenToken, typeOfExpressionSyntax.CloseParenToken))
{
expressionSyntax = typeOfExpressionSyntax.Type;
break;
}
switch (syntaxKind)
{
case SyntaxKind.SwitchSection:
if (LookupPosition.IsInSwitchSectionScope(position, (SwitchSectionSyntax)(object)val))
{
binder = rootBinder.GetBinder(val);
}
break;
case SyntaxKind.ArgumentList:
{
ArgumentListSyntax argumentListSyntax = (ArgumentListSyntax)(object)val;
if (LookupPosition.IsBetweenTokens(position, argumentListSyntax.OpenParenToken, argumentListSyntax.CloseParenToken))
{
binder = rootBinder.GetBinder(val);
}
break;
}
case SyntaxKind.EqualsValueClause:
binder = rootBinder.GetBinder(val);
break;
case SyntaxKind.Attribute:
binder = rootBinder.GetBinder(val);
break;
case SyntaxKind.ArrowExpressionClause:
binder = rootBinder.GetBinder(val);
break;
case SyntaxKind.BaseConstructorInitializer:
case SyntaxKind.ThisConstructorInitializer:
case SyntaxKind.PrimaryConstructorBaseType:
binder = rootBinder.GetBinder(val);
break;
case SyntaxKind.ConstructorDeclaration:
binder = rootBinder.GetBinder(val);
break;
case SyntaxKind.SwitchExpression:
binder = rootBinder.GetBinder(val);
break;
case SyntaxKind.SwitchExpressionArm:
binder = rootBinder.GetBinder(val);
break;
default:
if ((val as ExpressionSyntax).IsValidScopeDesignator())
{
binder = rootBinder.GetBinder(val);
}
else if (val is InvocationExpressionSyntax node2 && node2.MayBeNameofOperator())
{
binder = rootBinder.GetBinder(val);
}
else if (val is CheckedExpressionSyntax checkedExpressionSyntax && LookupPosition.IsBetweenTokens(position, checkedExpressionSyntax.OpenParenToken, checkedExpressionSyntax.CloseParenToken))
{
binder = rootBinder.GetBinder(val);
}
break;
}
break;
}
}
}
if (val == root)
{
break;
}
val = val.ParentOrStructuredTriviaParent;
}
binder = binder ?? rootBinder.GetBinder(root) ?? rootBinder;
if (localFunctionStatementSyntax != null)
{
LocalFunctionSymbol declaredLocalFunction = GetDeclaredLocalFunction(binder, localFunctionStatementSyntax.Identifier);
if ((object)declaredLocalFunction != null)
{
binder = declaredLocalFunction.WithTypeParametersBinder;
}
}
if (expressionSyntax != null)
{
binder = new TypeofBinder(expressionSyntax, binder);
}
return binder;
}
private static Binder AdjustBinderForPositionWithinStatement(int position, Binder binder, StatementSyntax stmt)
{
//IL_004e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: 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_0117: Unknown result type (might be due to invalid IL or missing references)
switch (stmt.Kind())
{
case SyntaxKind.SwitchStatement:
{
SwitchStatementSyntax switchStatementSyntax = (SwitchStatementSyntax)stmt;
if (LookupPosition.IsBetweenTokens(position, switchStatementSyntax.SwitchKeyword, switchStatementSyntax.OpenBraceToken))
{
binder = binder.GetBinder((SyntaxNode)(object)switchStatementSyntax.Expression);
}
break;
}
case SyntaxKind.ForStatement:
{
ForStatementSyntax forStatementSyntax = (ForStatementSyntax)stmt;
if (LookupPosition.IsBetweenTokens(position, forStatementSyntax.SecondSemicolonToken, forStatementSyntax.CloseParenToken) && forStatementSyntax.Incrementors.Count > 0)
{
binder = binder.GetBinder((SyntaxNode)(object)forStatementSyntax.Incrementors.First());
}
else if (LookupPosition.IsBetweenTokens(position, forStatementSyntax.FirstSemicolonToken, LookupPosition.GetFirstExcludedToken(forStatementSyntax)) && forStatementSyntax.Condition != null)
{
binder = binder.GetBinder((SyntaxNode)(object)forStatementSyntax.Condition);
}
break;
}
case SyntaxKind.ForEachStatement:
case SyntaxKind.ForEachVariableStatement:
{
CommonForEachStatementSyntax commonForEachStatementSyntax = (CommonForEachStatementSyntax)stmt;
SyntaxToken firstIncluded = ((stmt.Kind() == SyntaxKind.ForEachVariableStatement) ? commonForEachStatementSyntax.InKeyword : commonForEachStatementSyntax.OpenParenToken);
if (LookupPosition.IsBetweenTokens(position, firstIncluded, commonForEachStatementSyntax.Statement.GetFirstToken()))
{
binder = binder.GetBinder((SyntaxNode)(object)commonForEachStatementSyntax.Expression);
}
break;
}
}
return binder;
}
public override Conversion ClassifyConversion(ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false)
{
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
if (destination == null)
{
throw new ArgumentNullException("destination");
}
TypeSymbol destination2 = destination.EnsureCSharpSymbolOrNull("destination");
if (expression.Kind() == SyntaxKind.DeclarationExpression)
{
return Conversion.NoConversion;
}
if (((SyntaxNode)(object)expression).IsAnonymousFunction())
{
CheckSyntaxNode(expression);
return ClassifyConversion(((SyntaxNode)expression).SpanStart, expression, destination, isExplicitInSource);
}
if (isExplicitInSource)
{
return ClassifyConversionForCast(expression, destination2);
}
CheckSyntaxNode(expression);
Binder enclosingBinderInternal = GetEnclosingBinderInternal(expression, GetAdjustedNodePosition((SyntaxNode)(object)expression));
CSharpSyntaxNode bindableSyntaxNode = GetBindableSyntaxNode(expression);
BoundExpression boundExpression = GetLowerBoundNode(bindableSyntaxNode) as BoundExpression;
if (enclosingBinderInternal == null || boundExpression == null)
{
return Conversion.NoConversion;
}
CompoundUseSiteInfo<AssemblySymbol> useSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded;
return enclosingBinderInternal.Conversions.ClassifyConversionFromExpression(boundExpression, destination2, enclosingBinderInternal.CheckOverflowAtRuntime, ref useSiteInfo);
}
internal override Conversion ClassifyConversionForCast(ExpressionSyntax expression, TypeSymbol destination)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
CheckSyntaxNode(expression);
if ((object)destination == null)
{
throw new ArgumentNullException("destination");
}
Binder enclosingBinderInternal = GetEnclosingBinderInternal(expression, GetAdjustedNodePosition((SyntaxNode)(object)expression));
CSharpSyntaxNode bindableSyntaxNode = GetBindableSyntaxNode(expression);
BoundExpression boundExpression = GetLowerBoundNode(bindableSyntaxNode) as BoundExpression;
if (enclosingBinderInternal == null || boundExpression == null)
{
return Conversion.NoConversion;
}
CompoundUseSiteInfo<AssemblySymbol> useSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded;
return enclosingBinderInternal.Conversions.ClassifyConversionFromExpression(boundExpression, destination, enclosingBinderInternal.CheckOverflowAtRuntime, ref useSiteInfo, forCast: true);
}
internal virtual BoundNode GetBoundRoot()
{
return GetUpperBoundNode(GetBindableSyntaxNode(Root));
}
internal BoundNode GetUpperBoundNode(CSharpSyntaxNode node, bool promoteToBindable = false)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
if (promoteToBindable)
{
node = GetBindableSyntaxNode(node);
}
OneOrMany<BoundNode> boundNodes = GetBoundNodes(node);
if (boundNodes.Count == 0)
{
return null;
}
return boundNodes[0];
}
internal BoundNode GetLowerBoundNode(CSharpSyntaxNode node)
{
//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_0013: Unknown result type (might be due to invalid IL or missing references)
OneOrMany<BoundNode> boundNodes = GetBoundNodes(node);
if (boundNodes.Count == 0)
{
return null;
}
return GetLowerBoundNode(boundNodes);
}
private static BoundNode GetLowerBoundNode(OneOrMany<BoundNode> boundNodes)
{
return boundNodes[boundNodes.Count - 1];
}
public sealed override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotSupportedException();
}
public sealed override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotSupportedException();
}
public sealed override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotSupportedException();
}
public sealed override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotSupportedException();
}
public override INamespaceSymbol GetDeclaredSymbol(NamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override INamespaceSymbol GetDeclaredSymbol(FileScopedNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override INamedTypeSymbol GetDeclaredSymbol(BaseTypeDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override INamedTypeSymbol GetDeclaredSymbol(DelegateDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IFieldSymbol GetDeclaredSymbol(EnumMemberDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override ISymbol GetDeclaredSymbol(LocalFunctionStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
CheckSyntaxNode(declarationSyntax);
return (ISymbol)(object)GetDeclaredLocalFunction(declarationSyntax).GetPublicSymbol();
}
public override ISymbol GetDeclaredSymbol(MemberDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IMethodSymbol GetDeclaredSymbol(CompilationUnitSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IMethodSymbol GetDeclaredSymbol(BaseMethodDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override ISymbol GetDeclaredSymbol(BasePropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IPropertySymbol GetDeclaredSymbol(IndexerDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IEventSymbol GetDeclaredSymbol(EventDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IMethodSymbol GetDeclaredSymbol(AccessorDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IMethodSymbol GetDeclaredSymbol(ArrowExpressionClauseSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override ISymbol GetDeclaredSymbol(VariableDeclaratorSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
CheckSyntaxNode(declarationSyntax);
return (ISymbol)(object)GetDeclaredLocal(declarationSyntax, declarationSyntax.Identifier).GetPublicSymbol();
}
public override ISymbol GetDeclaredSymbol(SingleVariableDesignationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
CheckSyntaxNode(declarationSyntax);
return (ISymbol)(object)GetDeclaredLocal(declarationSyntax, declarationSyntax.Identifier).GetPublicSymbol();
}
private LocalSymbol GetDeclaredLocal(CSharpSyntaxNode declarationSyntax, SyntaxToken declaredIdentifier)
{
//IL_002a: 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)
for (Binder binder = GetEnclosingBinder(GetAdjustedNodePosition((SyntaxNode)(object)declarationSyntax)); binder != null; binder = binder.Next)
{
ImmutableArray<LocalSymbol>.Enumerator enumerator = binder.Locals.GetEnumerator();
while (enumerator.MoveNext())
{
LocalSymbol current = enumerator.Current;
if (current.IdentifierToken == declaredIdentifier)
{
return GetAdjustedLocalSymbol((SourceLocalSymbol)current);
}
}
}
return null;
}
internal override LocalSymbol GetAdjustedLocalSymbol(SourceLocalSymbol local)
{
return GetRemappedSymbol((LocalSymbol)local);
}
internal LocalFunctionSymbol GetDeclaredLocalFunction(LocalFunctionStatementSyntax declarationSyntax)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
LocalFunctionSymbol declaredLocalFunction = GetDeclaredLocalFunction(GetEnclosingBinder(GetAdjustedNodePosition((SyntaxNode)(object)declarationSyntax)), declarationSyntax.Identifier);
return GetRemappedSymbol(declaredLocalFunction);
}
private T GetRemappedSymbol<T>(T originalSymbol) where T : Symbol
{
EnsureNullabilityAnalysisPerformedIfNecessary();
if (_lazyRemappedSymbols == null)
{
return originalSymbol;
}
if (_lazyRemappedSymbols.TryGetValue(originalSymbol, out var value))
{
return (T)value;
}
return originalSymbol;
}
private static LocalFunctionSymbol GetDeclaredLocalFunction(Binder enclosingBinder, SyntaxToken declaredIdentifier)
{
//IL_001e: 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)
for (Binder binder = enclosingBinder; binder != null; binder = binder.Next)
{
ImmutableArray<LocalFunctionSymbol>.Enumerator enumerator = binder.LocalFunctions.GetEnumerator();
while (enumerator.MoveNext())
{
LocalFunctionSymbol current = enumerator.Current;
if (current.NameToken == declaredIdentifier)
{
return current;
}
}
}
return null;
}
public override ILabelSymbol GetDeclaredSymbol(LabeledStatementSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_0046: 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)
//IL_0057: 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)
//IL_0060: 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)
CheckSyntaxNode(declarationSyntax);
Binder binder = GetEnclosingBinder(GetAdjustedNodePosition((SyntaxNode)(object)declarationSyntax));
while (binder != null && !binder.IsLabelsScopeBinder)
{
binder = binder.Next;
}
if (binder != null)
{
ImmutableArray<LabelSymbol>.Enumerator enumerator = binder.Labels.GetEnumerator();
while (enumerator.MoveNext())
{
LabelSymbol current = enumerator.Current;
SyntaxNodeOrToken identifierNodeOrToken = current.IdentifierNodeOrToken;
if (((SyntaxNodeOrToken)(ref identifierNodeOrToken)).IsToken)
{
identifierNodeOrToken = current.IdentifierNodeOrToken;
if (((SyntaxNodeOrToken)(ref identifierNodeOrToken)).AsToken() == declarationSyntax.Identifier)
{
return current.GetPublicSymbol();
}
}
}
}
return null;
}
public override ILabelSymbol GetDeclaredSymbol(SwitchLabelSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_0046: 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)
//IL_0057: 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)
CheckSyntaxNode(declarationSyntax);
Binder binder = GetEnclosingBinder(GetAdjustedNodePosition((SyntaxNode)(object)declarationSyntax));
while (binder != null && !(binder is SwitchBinder))
{
binder = binder.Next;
}
if (binder != null)
{
ImmutableArray<LabelSymbol>.Enumerator enumerator = binder.Labels.GetEnumerator();
while (enumerator.MoveNext())
{
LabelSymbol current = enumerator.Current;
SyntaxNodeOrToken identifierNodeOrToken = current.IdentifierNodeOrToken;
if (((SyntaxNodeOrToken)(ref identifierNodeOrToken)).IsNode)
{
identifierNodeOrToken = current.IdentifierNodeOrToken;
if ((object)((SyntaxNodeOrToken)(ref identifierNodeOrToken)).AsNode() == declarationSyntax)
{
return current.GetPublicSymbol();
}
}
}
}
return null;
}
public override IAliasSymbol GetDeclaredSymbol(UsingDirectiveSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IAliasSymbol GetDeclaredSymbol(ExternAliasDirectiveSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IParameterSymbol GetDeclaredSymbol(ParameterSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
CheckSyntaxNode(declarationSyntax);
return GetLambdaOrLocalFunctionParameterSymbol(declarationSyntax, cancellationToken).GetPublicSymbol();
}
internal override ImmutableArray<ISymbol> GetDeclaredSymbols(BaseFieldDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
return ImmutableArray.Create<ISymbol>();
}
private ParameterSymbol GetLambdaOrLocalFunctionParameterSymbol(ParameterSyntax parameter, CancellationToken cancellationToken)
{
if (parameter.Parent is SimpleLambdaExpressionSyntax lambda)
{
return GetLambdaParameterSymbol(parameter, lambda, cancellationToken);
}
if (!(parameter.Parent is ParameterListSyntax { Parent: not null } parameterListSyntax))
{
return null;
}
if (((SyntaxNode)(object)parameterListSyntax.Parent).IsAnonymousFunction())
{
return GetLambdaParameterSymbol(parameter, (ExpressionSyntax)parameterListSyntax.Parent, cancellationToken);
}
if (parameterListSyntax.Parent.Kind() == SyntaxKind.LocalFunctionStatement)
{
MethodSymbol symbol = GetDeclaredSymbol((LocalFunctionStatementSyntax)parameterListSyntax.Parent, cancellationToken).GetSymbol<MethodSymbol>();
if ((object)symbol != null)
{
return GetParameterSymbol(symbol.Parameters, parameter, cancellationToken);
}
}
return null;
}
private ParameterSymbol GetLambdaParameterSymbol(ParameterSyntax parameter, ExpressionSyntax lambda, CancellationToken cancellationToken)
{
//IL_0003: 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)
SymbolInfo symbolInfo = GetSymbolInfo(lambda, cancellationToken);
LambdaSymbol symbol;
if (((SymbolInfo)(ref symbolInfo)).Symbol != null)
{
symbol = ((SymbolInfo)(ref symbolInfo)).Symbol.GetSymbol<LambdaSymbol>();
}
else
{
if (((SymbolInfo)(ref symbolInfo)).CandidateSymbols.Length != 1)
{
return null;
}
symbol = ((SymbolInfo)(ref symbolInfo)).CandidateSymbols.Single().GetSymbol<LambdaSymbol>();
}
return GetParameterSymbol(symbol.Parameters, parameter, cancellationToken);
}
public override ITypeParameterSymbol GetDeclaredSymbol(TypeParameterSyntax typeParameter, CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
public override IRangeVariableSymbol GetDeclaredSymbol(JoinIntoClauseSyntax node, CancellationToken cancellationToken = default(CancellationToken))
{
return GetBoundQueryClause(node)?.DefinedSymbol.GetPublicSymbol();
}
public override IRangeVariableSymbol GetDeclaredSymbol(QueryClauseSyntax queryClause, CancellationToken cancellationToken = default(CancellationToken))
{
return GetBoundQueryClause(queryClause)?.DefinedSymbol.GetPublicSymbol();
}
public override IRangeVariableSymbol GetDeclaredSymbol(QueryContinuationSyntax node, CancellationToken cancellationToken = default(CancellationToken))
{
return GetBoundQueryClause(node)?.DefinedSymbol.GetPublicSymbol();
}
public override AwaitExpressionInfo GetAwaitExpressionInfo(AwaitExpressionSyntax node)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
if (node.Kind() != SyntaxKind.AwaitExpression)
{
throw new ArgumentException("node.Kind==" + node.Kind());
}
BoundNode lowerBoundNode = GetLowerBoundNode((CSharpSyntaxNode)node);
BoundAwaitableInfo boundAwaitableInfo = (((lowerBoundNode as BoundExpressionStatement)?.Expression ?? lowerBoundNode) as BoundAwaitExpression)?.AwaitableInfo;
if (boundAwaitableInfo == null)
{
return default(AwaitExpressionInfo);
}
return new AwaitExpressionInfo((IMethodSymbol)(boundAwaitableInfo.GetAwaiter?.ExpressionSymbol.GetPublicSymbol()), boundAwaitableInfo.IsCompleted.GetPublicSymbol(), boundAwaitableInfo.GetResult.GetPublicSymbol(), boundAwaitableInfo.IsDynamic);
}
public override ForEachStatementInfo GetForEachStatementInfo(ForEachStatementSyntax node)
{
return GetForEachStatementInfo((CommonForEachStatementSyntax)node);
}
public override ForEachStatementInfo GetForEachStatementInfo(CommonForEachStatementSyntax node)
{
BoundForEachStatement boundForEachStatement = (BoundForEachStatement)GetUpperBoundNode(node);
if (boundForEachStatement == null)
{
return default(ForEachStatementInfo);
}
ForEachEnumeratorInfo enumeratorInfoOpt = boundForEachStatement.EnumeratorInfoOpt;
if (enumeratorInfoOpt == null)
{
return default(ForEachStatementInfo);
}
if (enumeratorInfoOpt.ElementType.IsPointerType())
{
return default(ForEachStatementInfo);
}
MethodSymbol symbol = null;
if (enumeratorInfoOpt.NeedsDisposal)
{
MethodArgumentInfo patternDisposeInfo = enumeratorInfoOpt.PatternDisposeInfo;
if ((object)patternDisposeInfo != null)
{
MethodSymbol method = patternDisposeInfo.Method;
symbol = method;
}
else
{
symbol = (enumeratorInfoOpt.IsAsync ? ((MethodSymbol)Compilation.GetWellKnownTypeMember((WellKnownMember)426)) : ((MethodSymbol)Compilation.GetSpecialTypeMember((SpecialMember)92)));
}
}
return new ForEachStatementInfo(enumeratorInfoOpt.IsAsync, enumeratorInfoOpt.GetEnumeratorInfo.Method.GetPublicSymbol(), enumeratorInfoOpt.MoveNextInfo.Method.GetPublicSymbol(), ((PropertySymbol)(enumeratorInfoOpt.CurrentPropertyGetter?.AssociatedSymbol)).GetPublicSymbol(), symbol.GetPublicSymbol(), enumeratorInfoOpt.ElementTypeWithAnnotations.GetPublicSymbol(), BoundNode.GetConversion(boundForEachStatement.ElementConversion, boundForEachStatement.ElementPlaceholder), BoundNode.GetConversion(enumeratorInfoOpt.CurrentConversion, enumeratorInfoOpt.CurrentPlaceholder));
}
public override DeconstructionInfo GetDeconstructionInfo(AssignmentExpressionSyntax node)
{
if (!(GetUpperBoundNode(node) is BoundDeconstructionAssignmentOperator boundDeconstructionAssignmentOperator))
{
return default(DeconstructionInfo);
}
BoundConversion right = boundDeconstructionAssignmentOperator.Right;
if (right == null)
{
return default(DeconstructionInfo);
}
return new DeconstructionInfo(right.Conversion);
}
public override DeconstructionInfo GetDeconstructionInfo(ForEachVariableStatementSyntax node)
{
BoundForEachStatement boundForEachStatement = (BoundForEachStatement)GetUpperBoundNode(node);
if (boundForEachStatement == null)
{
return default(DeconstructionInfo);
}
BoundForEachDeconstructStep deconstructionOpt = boundForEachStatement.DeconstructionOpt;
if (deconstructionOpt == null)
{
return default(DeconstructionInfo);
}
return new DeconstructionInfo(deconstructionOpt.DeconstructionAssignment.Right.Conversion);
}
private BoundQueryClause GetBoundQueryClause(CSharpSyntaxNode node)
{
CheckSyntaxNode(node);
return GetLowerBoundNode(node) as BoundQueryClause;
}
private QueryClauseInfo GetQueryClauseInfo(BoundQueryClause bound)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_0038: 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 (bound == null)
{
return default(QueryClauseInfo);
}
SymbolInfo castInfo = ((bound.Cast == null) ? SymbolInfo.None : GetSymbolInfoForNode(SymbolInfoOptions.DefaultOptions, bound.Cast, bound.Cast, null, null));
SymbolInfo symbolInfoForQuery = GetSymbolInfoForQuery(bound);
return new QueryClauseInfo(castInfo, symbolInfoForQuery);
}
private SymbolInfo GetSymbolInfoForQuery(BoundQueryClause bound)
{
//IL_0015: 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)
if (!(bound?.Operation is BoundCall boundCall))
{
return SymbolInfo.None;
}
BoundExpression boundExpression = (boundCall.IsDelegateCall ? boundCall.ReceiverOpt : boundCall);
return GetSymbolInfoForNode(SymbolInfoOptions.DefaultOptions, boundExpression, boundExpression, null, null);
}
private CSharpTypeInfo GetTypeInfoForQuery(BoundQueryClause bound)
{
if (bound != null)
{
return GetTypeInfoForNode(bound, bound, bound);
}
return CSharpTypeInfo.None;
}
public override QueryClauseInfo GetQueryClauseInfo(QueryClauseSyntax node, CancellationToken cancellationToken = default(CancellationToken))
{
BoundQueryClause boundQueryClause = GetBoundQueryClause(node);
return GetQueryClauseInfo(boundQueryClause);
}
public override IPropertySymbol GetDeclaredSymbol(AnonymousObjectMemberDeclaratorSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_003c: 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)
CheckSyntaxNode(declaratorSyntax);
AnonymousObjectCreationExpressionSyntax anonymousObjectCreationExpressionSyntax = (AnonymousObjectCreationExpressionSyntax)declaratorSyntax.Parent;
if (anonymousObjectCreationExpressionSyntax == null)
{
return null;
}
if (!(GetLowerBoundNode((CSharpSyntaxNode)anonymousObjectCreationExpressionSyntax) is BoundAnonymousObjectCreationExpression boundAnonymousObjectCreationExpression))
{
return null;
}
if (!(boundAnonymousObjectCreationExpression.Type is NamedTypeSymbol type))
{
return null;
}
int index = anonymousObjectCreationExpressionSyntax.Initializers.IndexOf(declaratorSyntax);
return AnonymousTypeManager.GetAnonymousTypeProperty(type, index).GetPublicSymbol();
}
public override INamedTypeSymbol GetDeclaredSymbol(AnonymousObjectCreationExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
CheckSyntaxNode(declaratorSyntax);
if (GetLowerBoundNode((CSharpSyntaxNode)declaratorSyntax) is BoundAnonymousObjectCreationExpression boundAnonymousObjectCreationExpression)
{
return (boundAnonymousObjectCreationExpression.Type as NamedTypeSymbol).GetPublicSymbol();
}
return null;
}
public override INamedTypeSymbol GetDeclaredSymbol(TupleExpressionSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
CheckSyntaxNode(declaratorSyntax);
return GetTypeOfTupleLiteral(declaratorSyntax).GetPublicSymbol();
}
public override ISymbol GetDeclaredSymbol(ArgumentSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
//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)
CheckSyntaxNode(declaratorSyntax);
if (!(declaratorSyntax?.Parent is TupleExpressionSyntax tupleExpressionSyntax))
{
return null;
}
NamedTypeSymbol typeOfTupleLiteral = GetTypeOfTupleLiteral(tupleExpressionSyntax);
if ((object)typeOfTupleLiteral != null)
{
ImmutableArray<FieldSymbol> tupleElements = typeOfTupleLiteral.TupleElements;
if (!tupleElements.IsDefault)
{
int index = tupleExpressionSyntax.Arguments.IndexOf(declaratorSyntax);
return (ISymbol)(object)tupleElements[index].GetPublicSymbol();
}
}
return null;
}
private NamedTypeSymbol GetTypeOfTupleLiteral(TupleExpressionSyntax declaratorSyntax)
{
return (GetLowerBoundNode((CSharpSyntaxNode)declaratorSyntax) as BoundTupleExpression)?.Type as NamedTypeSymbol;
}
internal unsafe override IOperation? GetOperationWorker(CSharpSyntaxNode node, CancellationToken cancellationToken)
{
//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_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)
ReadLockExiter val = ReaderWriterLockSlimExtensions.DisposableRead(_nodeMapLock);
try
{
if (_guardedIOperationNodeMap.Count != 0)
{
return guardedGetIOperation();
}
}
finally
{
((IDisposable)(*(ReadLockExiter*)(&val))/*cast due to constrained. prefix*/).Dispose();
}
IOperation rootOperation = GetRootOperation();
WriteLockExiter val2 = ReaderWriterLockSlimExtensions.DisposableWrite(_nodeMapLock);
try
{
if (_guardedIOperationNodeMap.Count != 0)
{
return guardedGetIOperation();
}
OperationMapBuilder.AddToMap(rootOperation, _guardedIOperationNodeMap);
return guardedGetIOperation();
}
finally
{
((IDisposable)(*(WriteLockExiter*)(&val2))/*cast due to constrained. prefix*/).Dispose();
}
IOperation? guardedGetIOperation()
{
ReaderWriterLockSlimExtensions.AssertCanRead(_nodeMapLock);
if (!_guardedIOperationNodeMap.TryGetValue((SyntaxNode)(object)node, out var value))
{
return null;
}
return value;
}
}
private IOperation GetRootOperation()
{
BoundNode boundNode = GetBoundRoot();
if (boundNode is BoundGlobalStatementInitializer boundGlobalStatementInitializer)
{
BoundStatement statement = boundGlobalStatementInitializer.Statement;
boundNode = statement;
}
IOperation? obj = _operationFactory.Value.Create(boundNode);
Operation.SetParentOperation<IOperation>(obj, (IOperation)null);
return obj;
}
internal override SymbolInfo GetSymbolInfoWorker(CSharpSyntaxNode node, SymbolInfoOptions options, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
CSharpSemanticModel.ValidateSymbolInfoOptions(options);
GetBoundNodes(node, out var _, out var lowestBoundNode, out var highestBoundNode, out var boundParent);
return GetSymbolInfoForNode(options, lowestBoundNode, highestBoundNode, boundParent, null);
}
internal override CSharpTypeInfo GetTypeInfoWorker(CSharpSyntaxNode node, CancellationToken cancellationToken = default(CancellationToken))
{
GetBoundNodes(node, out var _, out var lowestBoundNode, out var highestBoundNode, out var boundParent);
return GetTypeInfoForNode(lowestBoundNode, highestBoundNode, boundParent);
}
internal override ImmutableArray<Symbol> GetMemberGroupWorker(CSharpSyntaxNode node, SymbolInfoOptions options, CancellationToken cancellationToken = default(CancellationToken))
{
GetBoundNodes(node, out var _, out var lowestBoundNode, out var _, out var boundParent);
return GetMemberGroupForNode(options, lowestBoundNode, boundParent, null);
}
internal override ImmutableArray<IPropertySymbol> GetIndexerGroupWorker(CSharpSyntaxNode node, SymbolInfoOptions options, CancellationToken cancellationToken = default(CancellationToken))
{
GetBoundNodes(node, out var _, out var lowestBoundNode, out var _, out var _);
return GetIndexerGroupForNode(lowestBoundNode, null);
}
internal override Optional<object> GetConstantValueWorker(CSharpSyntaxNode node, CancellationToken cancellationToken)
{
//IL_001a: 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_0048: 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_0040: Unknown result type (might be due to invalid IL or missing references)
CSharpSyntaxNode bindableSyntaxNode = GetBindableSyntaxNode(node);
if (!(GetLowerBoundNode(bindableSyntaxNode) is BoundExpression boundExpression))
{
return default(Optional<object>);
}
ConstantValue constantValueOpt = boundExpression.ConstantValueOpt;
if (!(constantValueOpt == (ConstantValue)null) && !constantValueOpt.IsBad)
{
return new Optional<object>(constantValueOpt.Value);
}
return default(Optional<object>);
}
internal override SymbolInfo GetCollectionInitializerSymbolInfoWorker(InitializerExpressionSyntax collectionInitializer, ExpressionSyntax node, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_003a: 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_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (GetLowerBoundNode((CSharpSyntaxNode)collectionInitializer) is BoundCollectionInitializerExpression boundCollectionInitializerExpression)
{
BoundExpression boundExpression = boundCollectionInitializerExpression.Initializers[collectionInitializer.Expressions.IndexOf(node)];
return GetSymbolInfoForNode(SymbolInfoOptions.DefaultOptions, boundExpression, boundExpression, null, null);
}
return SymbolInfo.None;
}
public override SymbolInfo GetSymbolInfo(OrderingSyntax node, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
BoundQueryClause boundQueryClause = GetBoundQueryClause(node);
return GetSymbolInfoForQuery(boundQueryClause);
}
public override SymbolInfo GetSymbolInfo(SelectOrGroupClauseSyntax node, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
BoundQueryClause boundQueryClause = GetBoundQueryClause(node);
return GetSymbolInfoForQuery(boundQueryClause);
}
public override TypeInfo GetTypeInfo(SelectOrGroupClauseSyntax node, CancellationToken cancellationToken = default(CancellationToken))
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
BoundQueryClause boundQueryClause = GetBoundQueryClause(node);
return GetTypeInfoForQuery(boundQueryClause);
}
private void GetBoundNodes(CSharpSyntaxNode node, out CSharpSyntaxNode bindableNode, out BoundNode lowestBoundNode, out BoundNode highestBoundNode, out BoundNode boundParent)
{
bindableNode = GetBindableSyntaxNode(node);
CSharpSyntaxNode bindableParentNode = GetBindableParentNode(bindableNode);
if (bindableParentNode != null && bindableParentNode.Kind() == SyntaxKind.SimpleMemberAccessExpression && ((MemberAccessExpressionSyntax)bindableParentNode).Expression == bindableNode)
{
bindableParentNode = GetBindableParentNode(bindableParentNode);
}
boundParent = ((bindableParentNode == null) ? null : GetLowerBoundNode(bindableParentNode));
lowestBoundNode = GetLowerBoundNode(bindableNode);
highestBoundNode = GetUpperBoundNode(bindableNode);
}
private CSharpSyntaxNode GetInnermostLambdaOrQuery(CSharpSyntaxNode node, int position, bool allowStarting = false)
{
for (CSharpSyntaxNode cSharpSyntaxNode = node; cSharpSyntaxNode != Root; cSharpSyntaxNode = cSharpSyntaxNode.ParentOrStructuredTriviaParent)
{
if ((((SyntaxNode)(object)cSharpSyntaxNode).IsAnonymousFunction() || ((SyntaxNode)(object)cSharpSyntaxNode).IsQuery()) && LookupPosition.IsInAnonymousFunctionOrQuery(position, (SyntaxNode)(object)cSharpSyntaxNode) && (allowStarting || cSharpSyntaxNode != node))
{
return cSharpSyntaxNode;
}
}
return null;
}
private void GuardedAddSynthesizedStatementToMap(StatementSyntax node, BoundStatement statement)
{
if (_lazyGuardedSynthesizedStatementsMap == null)
{
_lazyGuardedSynthesizedStatementsMap = new Dictionary<SyntaxNode, BoundStatement>();
}
_lazyGuardedSynthesizedStatementsMap.Add((SyntaxNode)(object)node, statement);
}
private BoundStatement GuardedGetSynthesizedStatementFromMap(StatementSyntax node)
{
if (_lazyGuardedSynthesizedStatementsMap != null && _lazyGuardedSynthesizedStatementsMap.TryGetValue((SyntaxNode)(object)node, out var value))
{
return value;
}
return null;
}
private OneOrMany<BoundNode> GuardedGetBoundNodesFromMap(CSharpSyntaxNode node)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
if (!_guardedBoundNodeMap.TryGetValue((SyntaxNode)(object)node, out var value))
{
return OneOrMany<BoundNode>.Empty;
}
return value;
}
internal OneOrMany<BoundNode> TestOnlyTryGetBoundNodesFromMap(CSharpSyntaxNode node)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
if (!_guardedBoundNodeMap.TryGetValue((SyntaxNode)(object)node, out var value))
{
return OneOrMany<BoundNode>.Empty;
}
return value;
}
private OneOrMany<BoundNode> GuardedAddBoundTreeAndGetBoundNodeFromMap(CSharpSyntaxNode syntax, BoundNode bound)
{
//IL_0043: 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)
bool flag = false;
if (bound != null)
{
flag = _guardedBoundNodeMap.ContainsKey(bound.Syntax);
}
if (!flag)
{
NodeMapBuilder.AddToMap(bound, _guardedBoundNodeMap, SyntaxTree);
}
if (!_guardedBoundNodeMap.TryGetValue((SyntaxNode)(object)syntax, out var value))
{
return OneOrMany<BoundNode>.Empty;
}
return value;
}
protected unsafe void UnguardedAddBoundTreeForStandaloneSyntax(SyntaxNode syntax, BoundNode bound, NullableWalker.SnapshotManager manager = null, ImmutableDictionary<Symbol, Symbol> remappedSymbols = null)
{
//IL_0006: 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)
WriteLockExiter val = ReaderWriterLockSlimExtensions.DisposableWrite(_nodeMapLock);
try
{
GuardedAddBoundTreeForStandaloneSyntax(syntax, bound, manager, remappedSymbols);
}
finally
{
((IDisposable)(*(WriteLockExiter*)(&val))/*cast due to constrained. prefix*/).Dispose();
}
}
protected void GuardedAddBoundTreeForStandaloneSyntax(SyntaxNode syntax, BoundNode bound, NullableWalker.SnapshotManager manager = null, ImmutableDictionary<Symbol, Symbol> remappedSymbols = null)
{
bool flag = false;
if (bound != null)
{
flag = _guardedBoundNodeMap.ContainsKey(bound.Syntax);
}
if (!flag)
{
if ((object)syntax == _root || syntax is StatementSyntax)
{
NodeMapBuilder.AddToMap(bound, _guardedBoundNodeMap, SyntaxTree);
}
else
{
NodeMapBuilder.AddToMap(bound, _guardedBoundNodeMap, SyntaxTree, syntax);
}
if (manager != null)
{
_lazySnapshotManager = manager;
_lazyRemappedSymbols = remappedSymbols;
}
}
}
private CSharpSyntaxNode GetBindingRoot(CSharpSyntaxNode node)
{
for (CSharpSyntaxNode cSharpSyntaxNode = node; cSharpSyntaxNode != Root; cSharpSyntaxNode = cSharpSyntaxNode.ParentOrStructuredTriviaParent)
{
if (cSharpSyntaxNode is StatementSyntax)
{
return cSharpSyntaxNode;
}
switch (cSharpSyntaxNode.Kind())
{
case SyntaxKind.BaseConstructorInitializer:
case SyntaxKind.ThisConstructorInitializer:
case SyntaxKind.PrimaryConstructorBaseType:
return cSharpSyntaxNode;
case SyntaxKind.ArrowExpressionClause:
if (cSharpSyntaxNode.Parent == null || cSharpSyntaxNode.Parent.Kind() != SyntaxKind.LocalFunctionStatement)
{
return cSharpSyntaxNode;
}
break;
}
}
return Root;
}
internal override Binder GetEnclosingBinderInternal(int position)
{
//IL_0006: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
TextSpan fullSpan = ((SyntaxNode)Root).FullSpan;
if (!((TextSpan)(ref fullSpan)).Contains(position))
{
return RootBinder;
}
SyntaxToken val = Root.FindToken(position);
CSharpSyntaxNode node = (CSharpSyntaxNode)(object)((SyntaxToken)(ref val)).Parent;
return GetEnclosingBinderInternal(node, position);
}
private Binder GetEnclosingBinderInternal(CSharpSyntaxNode node, int position)
{
CSharpSyntaxNode innermostLambdaOrQuery = GetInnermostLambdaOrQuery(node, position, allowStarting: true);
if (innermostLambdaOrQuery == null)
{
return GetEnclosingBinderInternalWithinRoot((SyntaxNode)(object)node, position);
}
BoundNode boundInnerLambdaOrQuery = GetBoundLambdaOrQuery(innermostLambdaOrQuery);
return GetEnclosingBinderInLambdaOrQuery(position, node, innermostLambdaOrQuery, ref boundInnerLambdaOrQuery);
}
private unsafe BoundNode GetBoundLambdaOrQuery(CSharpSyntaxNode lambdaOrQuery)
{
//IL_000c: 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)
//IL_0015: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_00a0: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: 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_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Expected O, but got Unknown
EnsureNullabilityAnalysisPerformedIfNecessary();
ReadLockExiter val = ReaderWriterLockSlimExtensions.DisposableRead(_nodeMapLock);
OneOrMany<BoundNode> boundNodes;
try
{
boundNodes = GuardedGetBoundNodesFromMap(lambdaOrQuery);
}
finally
{
((IDisposable)(*(ReadLockExiter*)(&val))/*cast due to constrained. prefix*/).Dispose();
}
if (!boundNodes.IsEmpty)
{
return GetLowerBoundNode(boundNodes);
}
CSharpSyntaxNode bindingRoot = GetBindingRoot(lambdaOrQuery);
CSharpSyntaxNode innermostLambdaOrQuery = GetInnermostLambdaOrQuery(lambdaOrQuery, ((SyntaxNode)lambdaOrQuery).SpanStart);
BoundNode boundInnerLambdaOrQuery = null;
CSharpSyntaxNode node;
Binder next;
if (innermostLambdaOrQuery == null)
{
node = bindingRoot;
next = GetEnclosingBinderInternalWithinRoot((SyntaxNode)(object)node, GetAdjustedNodePosition((SyntaxNode)(object)node));
}
else
{
node = ((innermostLambdaOrQuery != bindingRoot && ((SyntaxNode)innermostLambdaOrQuery).Contains((SyntaxNode)(object)bindingRoot)) ? bindingRoot : lambdaOrQuery);
boundInnerLambdaOrQuery = GetBoundLambdaOrQuery(innermostLambdaOrQuery);
val = ReaderWriterLockSlimExtensions.DisposableRead(_nodeMapLock);
try
{
boundNodes = GuardedGetBoundNodesFromMap(lambdaOrQuery);
}
finally
{
((IDisposable)(*(ReadLockExiter*)(&val))/*cast due to constrained. prefix*/).Dispose();
}
if (!boundNodes.IsEmpty)
{
return GetLowerBoundNode(boundNodes);
}
next = GetEnclosingBinderInLambdaOrQuery(GetAdjustedNodePosition((SyntaxNode)(object)node), node, innermostLambdaOrQuery, ref boundInnerLambdaOrQuery);
}
Binder binder = new IncrementalBinder(this, next);
WriteLockExiter val2 = ReaderWriterLockSlimExtensions.DisposableWrite(_nodeMapLock);
try
{
BoundNode bound = Bind(binder, node, BindingDiagnosticBag.Discarded);
boundNodes = GuardedAddBoundTreeAndGetBoundNodeFromMap(lambdaOrQuery, bound);
}
finally
{
((IDisposable)(*(WriteLockExiter*)(&val2))/*cast due to constrained. prefix*/).Dispose();
}
if (!boundNodes.IsEmpty)
{
return GetLowerBoundNode(boundNodes);
}
next = ((innermostLambdaOrQuery != null) ? GetEnclosingBinderInLambdaOrQuery(GetAdjustedNodePosition((SyntaxNode)(object)lambdaOrQuery), lambdaOrQuery, innermostLambdaOrQuery, ref boundInnerLambdaOrQuery) : GetEnclosingBinderInternalWithinRoot((SyntaxNode)(object)lambdaOrQuery, GetAdjustedNodePosition((SyntaxNode)(object)lambdaOrQuery)));
binder = new IncrementalBinder(this, next);
val2 = ReaderWriterLockSlimExtensions.DisposableWrite(_nodeMapLock);
try
{
BoundNode boundNode = Bind(binder, lambdaOrQuery, BindingDiagnosticBag.Discarded);
if (!IsNullableAnalysisEnabled() && Compilation.IsNullableAnalysisEnabledAlways)
{
AnalyzeBoundNodeNullability(boundNode, binder, new DiagnosticBag(), createSnapshots: false);
}
boundNodes = GuardedAddBoundTreeAndGetBoundNodeFromMap(lambdaOrQuery, boundNode);
}
finally
{
((IDisposable)(*(WriteLockExiter*)(&val2))/*cast due to constrained. prefix*/).Dispose();
}
return GetLowerBoundNode(boundNodes);
}
private Binder GetEnclosingBinderInLambdaOrQuery(int position, CSharpSyntaxNode node, CSharpSyntaxNode innerLambdaOrQuery, ref BoundNode boundInnerLambdaOrQuery)
{
Binder binder;
switch (boundInnerLambdaOrQuery.Kind)
{
case BoundKind.UnboundLambda:
boundInnerLambdaOrQuery = ((UnboundLambda)boundInnerLambdaOrQuery).BindForErrorRecovery();
goto case BoundKind.Lambda;
case BoundKind.Lambda:
binder = GetLambdaEnclosingBinder(position, node, innerLambdaOrQuery, ((BoundLambda)boundInnerLambdaOrQuery).Binder);
break;
case BoundKind.QueryClause:
binder = GetQueryEnclosingBinder(position, node, (BoundQueryClause)boundInnerLambdaOrQuery);
break;
default:
return GetEnclosingBinderInternalWithinRoot((SyntaxNode)(object)node, position);
}
return binder.WithAdditionalFlags(GetSemanticModelBinderFlags());
}
private static Binder GetQueryEnclosingBinder(int position, CSharpSyntaxNode startingNode, BoundQueryClause queryClause)
{
BoundExpression boundExpression = queryClause;
do
{
switch (boundExpression.Kind)
{
case BoundKind.QueryClause:
queryClause = (BoundQueryClause)boundExpression;
boundExpression = GetQueryClauseValue(queryClause);
continue;
case BoundKind.Call:
{
BoundCall boundCall = (BoundCall)boundExpression;
boundExpression = GetContainingArgument(boundCall.Arguments, position);
if (boundExpression != null)
{
continue;
}
BoundExpression receiverOpt = boundCall.ReceiverOpt;
while (receiverOpt != null && receiverOpt.Kind == BoundKind.MethodGroup)
{
receiverOpt = ((BoundMethodGroup)receiverOpt).ReceiverOpt;
}
if (receiverOpt != null)
{
boundExpression = GetContainingExprOrQueryClause(receiverOpt, position);
if (boundExpression != null)
{
continue;
}
}
boundExpression = boundCall.Arguments.LastOrDefault();
continue;
}
case BoundKind.Conversion:
boundExpression = ((BoundConversion)boundExpression).Operand;
continue;
case BoundKind.UnboundLambda:
{
UnboundLambda unboundLambda = (UnboundLambda)boundExpression;
return GetEnclosingBinderInternalWithinRoot(AdjustStartingNodeAccordingToNewRoot((SyntaxNode)(object)startingNode, unboundLambda.Syntax), position, unboundLambda.BindForErrorRecovery().Binder, unboundLambda.Syntax);
}
case BoundKind.Lambda:
{
BoundLambda boundLambda = (BoundLambda)boundExpression;
return GetEnclosingBinderInternalWithinRoot(AdjustStartingNodeAccordingToNewRoot((SyntaxNode)(object)startingNode, boundLambda.Body.Syntax), position, boundLambda.Binder, boundLambda.Body.Syntax);
}
}
break;
}
while (boundExpression != null);
return GetEnclosingBinderInternalWithinRoot(AdjustStartingNodeAccordingToNewRoot((SyntaxNode)(object)startingNode, queryClause.Syntax), position, queryClause.Binder, queryClause.Syntax);
}
private static BoundExpression GetContainingArgument(ImmutableArray<BoundExpression> arguments, int position)
{
//IL_0004: 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_0030: 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)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
BoundExpression boundExpression = null;
TextSpan val = default(TextSpan);
ImmutableArray<BoundExpression>.Enumerator enumerator = arguments.GetEnumerator();
while (enumerator.MoveNext())
{
BoundExpression containingExprOrQueryClause = GetContainingExprOrQueryClause(enumerator.Current, position);
if (containingExprOrQueryClause != null)
{
TextSpan fullSpan = containingExprOrQueryClause.Syntax.FullSpan;
if (boundExpression == null || ((TextSpan)(ref val)).Contains(fullSpan))
{
boundExpression = containingExprOrQueryClause;
val = fullSpan;
}
}
}
return boundExpression;
}
private static BoundExpression GetContainingExprOrQueryClause(BoundExpression expr, int position)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
TextSpan fullSpan;
if (expr.Kind == BoundKind.QueryClause)
{
BoundExpression queryClauseValue = GetQueryClauseValue((BoundQueryClause)expr);
fullSpan = queryClauseValue.Syntax.FullSpan;
if (((TextSpan)(ref fullSpan)).Contains(position))
{
return queryClauseValue;
}
}
fullSpan = expr.Syntax.FullSpan;
if (((TextSpan)(ref fullSpan)).Contains(position))
{
return expr;
}
return null;
}
private static BoundExpression GetQueryClauseValue(BoundQueryClause queryClause)
{
return queryClause.UnoptimizedForm ?? queryClause.Value;
}
private static SyntaxNode AdjustStartingNodeAccordingToNewRoot(SyntaxNode startingNode, SyntaxNode root)
{
SyntaxNode val = (startingNode.Contains(root) ? root : startingNode);
if (val != root && !root.Contains(val))
{
val = root;
}
return val;
}
private static Binder GetLambdaEnclosingBinder(int position, CSharpSyntaxNode startingNode, CSharpSyntaxNode containingLambda, Binder lambdaBinder)
{
return GetEnclosingBinderInternalWithinRoot((SyntaxNode)(object)startingNode, position, lambdaBinder, (SyntaxNode)(object)containingLambda);
}
protected unsafe void EnsureNullabilityAnalysisPerformedIfNecessary()
{
//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)
bool flag = IsNullableAnalysisEnabled();
if ((!flag && !Compilation.IsNullableAnalysisEnabledAlways) || _lazySnapshotManager != null)
{
return;
}
CSharpSyntaxNode bindableRoot = GetBindableSyntaxNode(Root);
UpgradeableReadLockExiter val = ReaderWriterLockSlimExtensions.DisposableUpgradeableRead(_nodeMapLock);
ImmutableDictionary<Symbol, Symbol> remappedSymbols;
BoundNode boundRoot;
Binder binder;
NullableWalker.SnapshotManager snapshotManager;
try
{
if (_guardedBoundNodeMap.Count > 0)
{
return;
}
((UpgradeableReadLockExiter)(ref val)).EnterWrite();
remappedSymbols = _parentRemappedSymbolsOpt;
boundRoot = bind(bindableRoot, out binder);
if (((SemanticModel)this).IsSpeculativeSemanticModel)
{
NullableWalker.SnapshotManager parentSnapshotManagerOpt = ((SpeculativeSemanticModelWithMemberModel)_containingPublicSemanticModel).ParentSnapshotManagerOpt;
if (parentSnapshotManagerOpt == null || !flag)
{
rewriteAndCache();
return;
}
boundRoot = NullableWalker.AnalyzeAndRewriteSpeculation(((SemanticModel)_containingPublicSemanticModel).OriginalPositionForSpeculation, boundRoot, binder, parentSnapshotManagerOpt, out NullableWalker.SnapshotManager newSnapshots, ref remappedSymbols);
GuardedAddBoundTreeForStandaloneSyntax((SyntaxNode)(object)bindableRoot, boundRoot, newSnapshots, remappedSymbols);
}
else
{
rewriteAndCache();
}
}
finally
{
((IDisposable)(*(UpgradeableReadLockExiter*)(&val))/*cast due to constrained. prefix*/).Dispose();
}
BoundNode bind(CSharpSyntaxNode root, out Binder reference)
{
reference = GetBinderToBindNode(root);
return Bind(reference, root, BindingDiagnosticBag.Discarded);
}
void rewriteAndCache()
{
DiagnosticBag instance = DiagnosticBag.GetInstance();
boundRoot = RewriteNullableBoundNodesWithSnapshots(boundRoot, binder, instance, createSnapshots: true, out snapshotManager, ref remappedSymbols);
instance.Free();
GuardedAddBoundTreeForStandaloneSyntax((SyntaxNode)(object)bindableRoot, boundRoot, snapshotManager, remappedSymbols);
}
}
private Binder GetBinderToBindNode(CSharpSyntaxNode nodeToBind)
{
if (nodeToBind is CompilationUnitSyntax)
{
return RootBinder.GetBinder((SyntaxNode)(object)nodeToBind);
}
return GetEnclosingBinder(GetAdjustedNodePosition((SyntaxNode)(object)nodeToBind));
}
protected abstract BoundNode RewriteNullableBoundNodesWithSnapshots(BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots, out NullableWalker.SnapshotManager? snapshotManager, ref ImmutableDictionary<Symbol, Symbol>? remappedSymbols);
protected abstract void AnalyzeBoundNodeNullability(BoundNode boundRoot, Binder binder, DiagnosticBag diagnostics, bool createSnapshots);
protected abstract bool IsNullableAnalysisEnabled();
internal unsafe OneOrMany<BoundNode> GetBoundNodes(CSharpSyntaxNode node)
{
//IL_001d: 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)
//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)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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)
//IL_00c6: 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)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: 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)
if (node == null)
{
node = GetBindableSyntaxNode(Root);
}
EnsureNullabilityAnalysisPerformedIfNecessary();
ReadLockExiter val = ReaderWriterLockSlimExtensions.DisposableRead(_nodeMapLock);
OneOrMany<BoundNode> result;
try
{
result = GuardedGetBoundNodesFromMap(node);
}
finally
{
((IDisposable)(*(ReadLockExiter*)(&val))/*cast due to constrained. prefix*/).Dispose();
}
if (!result.IsEmpty)
{
return result;
}
CSharpSyntaxNode bindingRoot = GetBindingRoot(node);
Binder binderToBindNode = GetBinderToBindNode(bindingRoot);
Binder binder = new IncrementalBinder(this, binderToBindNode);
WriteLockExiter val2 = ReaderWriterLockSlimExtensions.DisposableWrite(_nodeMapLock);
try
{
BoundNode bound = Bind(binder, bindingRoot, BindingDiagnosticBag.Discarded);
result = GuardedAddBoundTreeAndGetBoundNodeFromMap(node, bound);
}
finally
{
((IDisposable)(*(WriteLockExiter*)(&val2))/*cast due to constrained. prefix*/).Dispose();
}
if (!result.IsEmpty)
{
return result;
}
Binder binderToBindNode2 = GetBinderToBindNode(node);
binder = new IncrementalBinder(this, binderToBindNode2);
val = ReaderWriterLockSlimExtensions.DisposableRead(_nodeMapLock);
try
{
result = GuardedGetBoundNodesFromMap(node);
}
finally
{
((IDisposable)(*(ReadLockExiter*)(&val))/*cast due to constrained. prefix*/).Dispose();
}
if (result.IsEmpty)
{
val2 = ReaderWriterLockSlimExtensions.DisposableWrite(_nodeMapLock);
try
{
BoundNode bound2 = Bind(binder, node, BindingDiagnosticBag.Discarded);
GuardedAddBoundTreeForStandaloneSyntax((SyntaxNode)(object)node, bound2);
result = GuardedGetBoundNodesFromMap(node);
}
finally
{
((IDisposable)(*(WriteLockExiter*)(&val2))/*cast due to constrained. prefix*/).Dispose();
}
if (!result.IsEmpty)
{
return result;
}
return OneOrMany<BoundNode>.Empty;
}
return result;
}
protected internal virtual CSharpSyntaxNode GetBindableSyntaxNode(CSharpSyntaxNode node)
{
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
switch (node.Kind())
{
case SyntaxKind.GlobalStatement:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.OperatorDeclaration:
case SyntaxKind.ConversionOperatorDeclaration:
case SyntaxKind.ConstructorDeclaration:
case SyntaxKind.DestructorDeclaration:
case SyntaxKind.GetAccessorDeclaration:
case SyntaxKind.SetAccessorDeclaration:
case SyntaxKind.AddAccessorDeclaration:
case SyntaxKind.RemoveAccessorDeclaration:
case SyntaxKind.Subpattern:
case SyntaxKind.InitAccessorDeclaration:
return node;
case SyntaxKind.PositionalPatternClause:
return node.Parent;
}
while (true)
{
if (!(node is ParenthesizedExpressionSyntax parenthesizedExpressionSyntax))
{
if (!(node is CheckedExpressionSyntax checkedExpressionSyntax))
{
if (node is PostfixUnaryExpressionSyntax postfixUnaryExpressionSyntax)
{
if (((SyntaxNode)node).RawKind != 9054)
{
break;
}
node = postfixUnaryExpressionSyntax.Operand;
}
else if (!(node is UnsafeStatementSyntax unsafeStatementSyntax))
{
if (!(node is CheckedStatementSyntax checkedStatementSyntax))
{
break;
}
node = checkedStatementSyntax.Block;
}
else
{
node = unsafeStatementSyntax.Block;
}
}
else
{
node = checkedExpressionSyntax.Expression;
}
}
else
{
node = parenthesizedExpressionSyntax.Expression;
}
}
CSharpSyntaxNode parent = node.Parent;
if (parent != null && node != Root)
{
switch (node.Kind())
{
case SyntaxKind.IdentifierName:
case SyntaxKind.GenericName:
{
CSharpSyntaxNode standaloneNode = SyntaxFactory.GetStandaloneNode(node);
if (standaloneNode != node)
{
return GetBindableSyntaxNode(standaloneNode);
}
break;
}
case SyntaxKind.AnonymousObjectMemberDeclarator:
return GetBindableSyntaxNode(parent);
case SyntaxKind.VariableDeclarator:
{
CSharpSyntaxNode parent2 = parent.Parent;
if (parent2 != null && parent2.Kind() == SyntaxKind.LocalDeclarationStatement && ((VariableDeclarationSyntax)parent).Variables.Count == 1)
{
return GetBindableSyntaxNode(parent);
}
break;
}
default:
if ((node is QueryExpressionSyntax && parent is QueryContinuationSyntax) || (!(node is ExpressionSyntax) && !(node is StatementSyntax) && !(node is SelectOrGroupClauseSyntax) && !(node is QueryClauseSyntax) && !(node is OrderingSyntax) && !(node is JoinIntoClauseSyntax) && !(node is QueryContinuationSyntax) && !(node is ConstructorInitializerSyntax) && !(node is PrimaryConstructorBaseTypeSyntax) && !(node is ArrowExpressionClauseSyntax) && !(node is PatternSyntax)))
{
return GetBindableSyntaxNode(parent);
}
break;
}
}
return node;
}
protected CSharpSyntaxNode? GetBindableParentNode(CSharpSyntaxNode node)
{
if (!(node is ExpressionSyntax))
{
return null;
}
CSharpSyntaxNode cSharpSyntaxNode = node.Parent;
if (cSharpSyntaxNode == null)
{
if (((SemanticModel)this).IsSpeculativeSemanticModel && Root == node)
{
return null;
}
throw new ArgumentException("The parent of node must not be null unless this is a speculative semantic model.", "node");
}
while (true)
{
SyntaxKind syntaxKind = cSharpSyntaxNode.Kind();
if (syntaxKind != SyntaxKind.ParenthesizedExpression && syntaxKind - 9050 > SyntaxKind.List && syntaxKind != SyntaxKind.ScopedType)
{
break;
}
CSharpSyntaxNode parent = cSharpSyntaxNode.Parent;
if (parent != null)
{
cSharpSyntaxNode = parent;
}
}
CSharpSyntaxNode cSharpSyntaxNode2 = GetBindableSyntaxNode(cSharpSyntaxNode);
ArrayTypeSyntax arrayTypeSyntax;
if (cSharpSyntaxNode2 != null)
{
int rawKind = ((SyntaxNode)cSharpSyntaxNode2).RawKind;
if (rawKind == 8689)
{
CSharpSyntaxNode parent2 = cSharpSyntaxNode2.Parent;
if (parent2 == null || ((SyntaxNode)parent2).RawKind != 8634)
{
arrayTypeSyntax = cSharpSyntaxNode2 as ArrayTypeSyntax;
if (arrayTypeSyntax != null)
{
goto IL_00ca;
}
}
else
{
cSharpSyntaxNode2 = cSharpSyntaxNode2.Parent;
}
}
else
{
arrayTypeSyntax = cSharpSyntaxNode2 as ArrayTypeSyntax;
if (arrayTypeSyntax != null)
{
goto IL_00ca;
}
if (rawKind == 8648)
{
cSharpSyntaxNode2 = null;
}
}
}
goto IL_00d6;
IL_00ca:
cSharpSyntaxNode2 = SyntaxFactory.GetStandaloneExpression(arrayTypeSyntax);
goto IL_00d6;
IL_00d6:
return cSharpSyntaxNode2;
}
internal override Symbol RemapSymbolIfNecessaryCore(Symbol symbol)
{
EnsureNullabilityAnalysisPerformedIfNecessary();
if (_lazyRemappedSymbols == null)
{
return symbol;
}
if (_lazyRemappedSymbols.TryGetValue(symbol, out var value))
{
return value;
}
return symbol;
}
internal sealed override Func<SyntaxNode, bool> GetSyntaxNodesToAnalyzeFilter(SyntaxNode declaredNode, ISymbol declaredSymbol)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs", 2336);
}
internal sealed override bool ShouldSkipSyntaxNodeAnalysis(SyntaxNode node, ISymbol containingSymbol)
{
throw ExceptionUtilities.Unreachable("/_/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs", 2341);
}
}