5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
14138return new LocalState(snapshot.Id, container, snapshot.State.Clone()); 14167return new LocalState(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true)); 14190return new LocalState(variables.Id, container, CreateBitVector(reachable)); 14196return new LocalState(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true)); 14396return new LocalState(Id, container, _state.Clone());
142 references to LocalState
Microsoft.CodeAnalysis.CSharp (142)
FlowAnalysis\NullableWalker_Patterns.cs (21)
39var currentState = State; 276protected override LocalState VisitSwitchStatementDispatch(BoundSwitchStatement node) 314var afterSwitchState = labelStateMap.TryGetValue(node.BreakLabel, out var stateAndReachable) ? stateAndReachable.state : UnreachableState(); 342public LocalState State; 343public LocalState StateWhenTrue; 344public LocalState StateWhenFalse; 347public PossiblyConditionalState(LocalState stateWhenTrue, LocalState stateWhenFalse) 355public PossiblyConditionalState(LocalState state) 377private PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> LearnFromDecisionDag( 421var labelStateMap = PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)>.GetInstance(); 842void learnFromNonNullTest(int inputSlot, ref LocalState state) 922void gotoNode(BoundDecisionDagNode node, LocalState state, bool believedReachable, BoundDecisionDagNode from, bool whenTrueBranch) 1083var endState = UnreachableState(); 1181PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap, 1195var armState = getStateForArm(arm, labelStateMap); 1226PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap, 1238LocalState getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap) 1255var trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState(); 1256var falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();
FlowAnalysis\NullableWalker.cs (120)
27: LocalDataFlowPass<NullableWalker.LocalState, NullableWalker.LocalFunctionState> 123public readonly Optional<LocalState> StateForLambda; 139public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda) 272/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional&lt;LocalState&gt;,bool, int, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 683void enforceMemberNotNull(SyntaxNode? syntaxOpt, LocalState state) 762void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis) 1135private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt, LocalState state, MethodSymbol method, string memberName) 1185void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members, LocalState state, LocalState otherState) 1197void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense, LocalState state) 1213private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member, LocalState state) 1222private bool FailsMemberNotNullExpectation(Symbol member, LocalState state) 1353private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt, LocalState state) 1399private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense, LocalState stateWhen) 1412private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense, LocalState stateWhen) 1421bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense, LocalState stateWhen) 1459private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt, LocalState state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam) 1762Analyze(walker, symbol, diagnostics: null, LocalState.Create(localState), snapshotBuilderOpt: newSnapshotBuilder); 1883var localState = LocalState.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables); 1936Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<LocalState>)default : LocalState.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis); 1953Optional<LocalState> initialState, 2047private NullableFlowState GetState(ref LocalState state, int slot) 2056private void SetState(ref LocalState state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false) 2065private void NormalizeIfNeeded(ref LocalState state, int slot, bool useNotNullsAsDefault) 2070protected override void Normalize(ref LocalState state) 2078private NullableFlowState GetDefaultState(ref LocalState state, int slot) 2912private void SetStateAndTrackForFinally(ref LocalState state, int slot, NullableFlowState newState) 2918var tryState = NonMonotonicState.Value; 2927protected override void JoinTryBlockState(ref LocalState self, ref LocalState other) 2929var tryState = other.GetStateForVariables(self.Id); 3023protected override LocalState TopState() 3025var state = LocalState.ReachableState(_variables); 3030protected override LocalState UnreachableState() 3032return LocalState.UnreachableState(_variables); 3035protected override LocalState ReachableBottomState() 3038return LocalState.ReachableStateWithNotNulls(_variables); 3071var parameterDefaultsNotAssignedState = State.Clone(); 3196var joinedState = this.StateWhenTrue.Clone(); 3427var state = TopState(); 3453var startingState = localFunctionState.StartingState; 3496LocalState state, 3522var oldState = this.State; 3599void enforceMemberNotNull(SyntaxNode? syntax, LocalState state) 3626var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3767var currentState = State; 5015private void SetNotNullResultForLambda(BoundExpression node, LocalState stateForLambda) 5515var stateAfterLeft = this.State; 5518var stateWhenNotNull = this.State; 5574LocalState getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull) 5576LocalState stateWhenNotNull; 5612var stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull); 5961ref LocalState stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse; 5967protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref LocalState shortCircuitState) 6072private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref LocalState stateToUpdate) 6080private void LearnFromNonNullTest(BoundExpression expression, ref LocalState state) 6103private void LearnFromNonNullTest(int slot, ref LocalState state) 6108private void LearnFromNullTest(BoundExpression expression, ref LocalState state) 6126private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref LocalState state, bool markDependentSlotsNotNull) 6146private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref LocalState state, int depth = 2) 6227var leftState = this.State.Clone(); 6448var savedState = this.State.Clone(); 6557var consequenceState = this.StateWhenTrue; 6558var alternativeState = this.StateWhenFalse; 6683BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative, LocalState consequenceState, LocalState alternativeState, 6730LocalState consequenceState, 6731LocalState alternativeState, 6751(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6764(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6787LocalState state, 8122void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref LocalState state) 8135void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref LocalState state) 8163LocalState markMemberAsNotNull(int receiverSlot, ref LocalState state, Symbol member) 8567var originalWhenFalse = StateWhenFalse.Clone(); 8573var newWhenTrue = State.Clone(); 8754private static VariableState GetVariableState(Variables variables, LocalState localState) 9482var savedState = this.State.Clone(); 9943Optional<LocalState> stateForLambda = default, 11281var stateForLambda = this.State.Clone(); 11293private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<LocalState> initialState = default) 13157var leftTrue = this.StateWhenTrue; 13158var leftFalse = this.StateWhenFalse; 13174var leftTrue = this.StateWhenTrue; 13175var leftFalse = this.StateWhenFalse; 13187var rightState = State.Clone(); 13204var leftState = isAnd ? leftFalse : leftTrue; 13241protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref LocalState leftTrue, ref LocalState leftFalse) 13334LocalState stateWhenNotNull; 14004protected override string Dump(LocalState state) 14009protected override bool Meet(ref LocalState self, ref LocalState other) 14026protected override bool Join(ref LocalState self, ref LocalState other) 14063private LocalState CloneAndUnsplit(ref PossiblyConditionalState conditionalState) 14070var state = conditionalState.StateWhenTrue.Clone(); 14112internal LocalState Value; 14114internal Boxed(LocalState value) 14135internal static LocalState Create(LocalStateSnapshot snapshot) 14150public static LocalState ReachableState(Variables variables) 14155public static LocalState UnreachableState(Variables variables) 14160public static LocalState ReachableStateWithNotNulls(Variables variables) 14184private static LocalState CreateReachableOrUnreachableState(Variables variables, bool reachable) 14193public LocalState CreateNestedMethodState(Variables variables) 14222bool hasVariableCore(ref LocalState state, int id, int index) 14240static bool hasValue(ref LocalState state, int slot) 14250static bool hasValueCore(ref LocalState state, int id, int index) 14379internal LocalState GetStateForVariables(int id) 14381var state = this; 14393public LocalState Clone() 14399public bool Join(in LocalState other) 14428public bool Meet(in LocalState other) 14519public LocalState StartingState; 14521public LocalFunctionState(LocalState unreachableState) 14533return new LocalFunctionState(LocalState.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
208internal void TakeIncrementalSnapshot(BoundNode? node, LocalState currentState)