5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
13397return new LocalState(snapshot.Id, container, snapshot.State.Clone()); 13426return new LocalState(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true)); 13449return new LocalState(variables.Id, container, CreateBitVector(reachable)); 13455return new LocalState(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true)); 13655return new LocalState(Id, container, _state.Clone());
140 references to LocalState
Microsoft.CodeAnalysis.CSharp (140)
FlowAnalysis\NullableWalker.cs (118)
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, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 661void enforceMemberNotNull(SyntaxNode? syntaxOpt, LocalState state) 740void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis) 1078private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt, LocalState state, MethodSymbol method, string memberName) 1128void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members, LocalState state, LocalState otherState) 1140void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense, LocalState state) 1156private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member, LocalState state) 1165private bool FailsMemberNotNullExpectation(Symbol member, LocalState state) 1296private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt, LocalState state) 1342private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense, LocalState stateWhen) 1355private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense, LocalState stateWhen) 1364bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense, LocalState stateWhen) 1402private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt, LocalState state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam) 1705Analyze(walker, symbol, diagnostics: null, LocalState.Create(localState), snapshotBuilderOpt: newSnapshotBuilder); 1826var localState = LocalState.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables); 1879Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<LocalState>)default : LocalState.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis); 1896Optional<LocalState> initialState, 1990private NullableFlowState GetState(ref LocalState state, int slot) 1999private void SetState(ref LocalState state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false) 2008private void NormalizeIfNeeded(ref LocalState state, int slot, bool useNotNullsAsDefault) 2013protected override void Normalize(ref LocalState state) 2021private NullableFlowState GetDefaultState(ref LocalState state, int slot) 2829private void SetStateAndTrackForFinally(ref LocalState state, int slot, NullableFlowState newState) 2835var tryState = NonMonotonicState.Value; 2844protected override void JoinTryBlockState(ref LocalState self, ref LocalState other) 2846var tryState = other.GetStateForVariables(self.Id); 2940protected override LocalState TopState() 2942var state = LocalState.ReachableState(_variables); 2947protected override LocalState UnreachableState() 2949return LocalState.UnreachableState(_variables); 2952protected override LocalState ReachableBottomState() 2955return LocalState.ReachableStateWithNotNulls(_variables); 2988var parameterDefaultsNotAssignedState = State.Clone(); 3113var joinedState = this.StateWhenTrue.Clone(); 3344var state = TopState(); 3370var startingState = localFunctionState.StartingState; 3413LocalState state, 3439var oldState = this.State; 3516void enforceMemberNotNull(SyntaxNode? syntax, LocalState state) 3543var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3657var currentState = State; 4845private void SetNotNullResultForLambda(BoundExpression node, LocalState stateForLambda) 5345var stateAfterLeft = this.State; 5348var stateWhenNotNull = this.State; 5404LocalState getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull) 5406LocalState stateWhenNotNull; 5442var stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull); 5775ref LocalState stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse; 5781protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref LocalState shortCircuitState) 5886private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref LocalState stateToUpdate) 5894private void LearnFromNonNullTest(BoundExpression expression, ref LocalState state) 5917private void LearnFromNonNullTest(int slot, ref LocalState state) 5922private void LearnFromNullTest(BoundExpression expression, ref LocalState state) 5940private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref LocalState state, bool markDependentSlotsNotNull) 5960private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref LocalState state, int depth = 2) 6041var leftState = this.State.Clone(); 6260var savedState = this.State.Clone(); 6369var consequenceState = this.StateWhenTrue; 6370var alternativeState = this.StateWhenFalse; 6495BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative, LocalState consequenceState, LocalState alternativeState, 6542LocalState consequenceState, 6543LocalState alternativeState, 6563(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6576(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 6599LocalState state, 7878void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref LocalState state) 7891void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref LocalState state) 8315var originalWhenFalse = StateWhenFalse.Clone(); 8321var newWhenTrue = State.Clone(); 8483private static VariableState GetVariableState(Variables variables, LocalState localState) 9211var savedState = this.State.Clone(); 9594Optional<LocalState> stateForLambda = default, 10675var stateForLambda = this.State.Clone(); 10687private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<LocalState> initialState = default) 12474var leftTrue = this.StateWhenTrue; 12475var leftFalse = this.StateWhenFalse; 12491var leftTrue = this.StateWhenTrue; 12492var leftFalse = this.StateWhenFalse; 12504var rightState = State.Clone(); 12521var leftState = isAnd ? leftFalse : leftTrue; 12558protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref LocalState leftTrue, ref LocalState leftFalse) 12653LocalState stateWhenNotNull; 13263protected override string Dump(LocalState state) 13268protected override bool Meet(ref LocalState self, ref LocalState other) 13285protected override bool Join(ref LocalState self, ref LocalState other) 13322private LocalState CloneAndUnsplit(ref PossiblyConditionalState conditionalState) 13329var state = conditionalState.StateWhenTrue.Clone(); 13371internal LocalState Value; 13373internal Boxed(LocalState value) 13394internal static LocalState Create(LocalStateSnapshot snapshot) 13409public static LocalState ReachableState(Variables variables) 13414public static LocalState UnreachableState(Variables variables) 13419public static LocalState ReachableStateWithNotNulls(Variables variables) 13443private static LocalState CreateReachableOrUnreachableState(Variables variables, bool reachable) 13452public LocalState CreateNestedMethodState(Variables variables) 13481bool hasVariableCore(ref LocalState state, int id, int index) 13499static bool hasValue(ref LocalState state, int slot) 13509static bool hasValueCore(ref LocalState state, int id, int index) 13638internal LocalState GetStateForVariables(int id) 13640var state = this; 13652public LocalState Clone() 13658public bool Join(in LocalState other) 13687public bool Meet(in LocalState other) 13778public LocalState StartingState; 13780public LocalFunctionState(LocalState unreachableState) 13792return new LocalFunctionState(LocalState.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
208internal void TakeIncrementalSnapshot(BoundNode? node, LocalState currentState)
FlowAnalysis\NullableWalker_Patterns.cs (21)
37var currentState = State; 273protected override LocalState VisitSwitchStatementDispatch(BoundSwitchStatement node) 311var afterSwitchState = labelStateMap.TryGetValue(node.BreakLabel, out var stateAndReachable) ? stateAndReachable.state : UnreachableState(); 339public LocalState State; 340public LocalState StateWhenTrue; 341public LocalState StateWhenFalse; 344public PossiblyConditionalState(LocalState stateWhenTrue, LocalState stateWhenFalse) 352public PossiblyConditionalState(LocalState state) 374private PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> LearnFromDecisionDag( 416var labelStateMap = PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)>.GetInstance(); 731void learnFromNonNullTest(int inputSlot, ref LocalState state) 806void gotoNode(BoundDecisionDagNode node, LocalState state, bool believedReachable) 895var endState = UnreachableState(); 989PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap, 1003var armState = getStateForArm(arm, labelStateMap); 1034PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap, 1046LocalState getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap) 1063var trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState(); 1064var falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();