5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
13976return new LocalState(snapshot.Id, container, snapshot.State.Clone()); 14005return new LocalState(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true)); 14028return new LocalState(variables.Id, container, CreateBitVector(reachable)); 14034return new LocalState(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true)); 14234return 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;)"/>. 679void enforceMemberNotNull(SyntaxNode? syntaxOpt, LocalState state) 758void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis) 1096private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt, LocalState state, MethodSymbol method, string memberName) 1146void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members, LocalState state, LocalState otherState) 1158void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense, LocalState state) 1174private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member, LocalState state) 1183private bool FailsMemberNotNullExpectation(Symbol member, LocalState state) 1314private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt, LocalState state) 1360private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense, LocalState stateWhen) 1373private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense, LocalState stateWhen) 1382bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense, LocalState stateWhen) 1420private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt, LocalState state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam) 1723Analyze(walker, symbol, diagnostics: null, LocalState.Create(localState), snapshotBuilderOpt: newSnapshotBuilder); 1844var localState = LocalState.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables); 1897Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<LocalState>)default : LocalState.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis); 1914Optional<LocalState> initialState, 2008private NullableFlowState GetState(ref LocalState state, int slot) 2017private void SetState(ref LocalState state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false) 2026private void NormalizeIfNeeded(ref LocalState state, int slot, bool useNotNullsAsDefault) 2031protected override void Normalize(ref LocalState state) 2039private NullableFlowState GetDefaultState(ref LocalState state, int slot) 2861private void SetStateAndTrackForFinally(ref LocalState state, int slot, NullableFlowState newState) 2867var tryState = NonMonotonicState.Value; 2876protected override void JoinTryBlockState(ref LocalState self, ref LocalState other) 2878var tryState = other.GetStateForVariables(self.Id); 2972protected override LocalState TopState() 2974var state = LocalState.ReachableState(_variables); 2979protected override LocalState UnreachableState() 2981return LocalState.UnreachableState(_variables); 2984protected override LocalState ReachableBottomState() 2987return LocalState.ReachableStateWithNotNulls(_variables); 3020var parameterDefaultsNotAssignedState = State.Clone(); 3145var joinedState = this.StateWhenTrue.Clone(); 3376var state = TopState(); 3402var startingState = localFunctionState.StartingState; 3445LocalState state, 3471var oldState = this.State; 3548void enforceMemberNotNull(SyntaxNode? syntax, LocalState state) 3575var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3716var currentState = State; 4941private void SetNotNullResultForLambda(BoundExpression node, LocalState stateForLambda) 5441var stateAfterLeft = this.State; 5444var stateWhenNotNull = this.State; 5500LocalState getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull) 5502LocalState stateWhenNotNull; 5538var stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull); 5871ref LocalState stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse; 5877protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref LocalState shortCircuitState) 5982private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref LocalState stateToUpdate) 5990private void LearnFromNonNullTest(BoundExpression expression, ref LocalState state) 6013private void LearnFromNonNullTest(int slot, ref LocalState state) 6018private void LearnFromNullTest(BoundExpression expression, ref LocalState state) 6036private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref LocalState state, bool markDependentSlotsNotNull) 6056private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref LocalState state, int depth = 2) 6137var leftState = this.State.Clone(); 6358var savedState = this.State.Clone(); 6467var consequenceState = this.StateWhenTrue; 6468var alternativeState = this.StateWhenFalse; 6593BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative, LocalState consequenceState, LocalState alternativeState, 6640LocalState consequenceState, 6641LocalState alternativeState, 6661(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6674(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6697LocalState state, 8025void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref LocalState state) 8038void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref LocalState state) 8066LocalState markMemberAsNotNull(int receiverSlot, ref LocalState state, Symbol member) 8470var originalWhenFalse = StateWhenFalse.Clone(); 8476var newWhenTrue = State.Clone(); 8657private static VariableState GetVariableState(Variables variables, LocalState localState) 9385var savedState = this.State.Clone(); 9826Optional<LocalState> stateForLambda = default, 11143var stateForLambda = this.State.Clone(); 11155private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<LocalState> initialState = default) 13003var leftTrue = this.StateWhenTrue; 13004var leftFalse = this.StateWhenFalse; 13020var leftTrue = this.StateWhenTrue; 13021var leftFalse = this.StateWhenFalse; 13033var rightState = State.Clone(); 13050var leftState = isAnd ? leftFalse : leftTrue; 13087protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref LocalState leftTrue, ref LocalState leftFalse) 13180LocalState stateWhenNotNull; 13842protected override string Dump(LocalState state) 13847protected override bool Meet(ref LocalState self, ref LocalState other) 13864protected override bool Join(ref LocalState self, ref LocalState other) 13901private LocalState CloneAndUnsplit(ref PossiblyConditionalState conditionalState) 13908var state = conditionalState.StateWhenTrue.Clone(); 13950internal LocalState Value; 13952internal Boxed(LocalState value) 13973internal static LocalState Create(LocalStateSnapshot snapshot) 13988public static LocalState ReachableState(Variables variables) 13993public static LocalState UnreachableState(Variables variables) 13998public static LocalState ReachableStateWithNotNulls(Variables variables) 14022private static LocalState CreateReachableOrUnreachableState(Variables variables, bool reachable) 14031public LocalState CreateNestedMethodState(Variables variables) 14060bool hasVariableCore(ref LocalState state, int id, int index) 14078static bool hasValue(ref LocalState state, int slot) 14088static bool hasValueCore(ref LocalState state, int id, int index) 14217internal LocalState GetStateForVariables(int id) 14219var state = this; 14231public LocalState Clone() 14237public bool Join(in LocalState other) 14266public bool Meet(in LocalState other) 14357public LocalState StartingState; 14359public LocalFunctionState(LocalState unreachableState) 14371return new LocalFunctionState(LocalState.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
208internal void TakeIncrementalSnapshot(BoundNode? node, LocalState currentState)