5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
11337return new LocalState(snapshot.Id, container, snapshot.State.Clone()); 11366return new LocalState(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true)); 11389return new LocalState(variables.Id, container, CreateBitVector(reachable)); 11395return new LocalState(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true)); 11591return new LocalState(Id, container, _state.Clone());
135 references to LocalState
Microsoft.CodeAnalysis.CSharp (135)
FlowAnalysis\NullableWalker.cs (113)
27: LocalDataFlowPass<NullableWalker.LocalState, NullableWalker.LocalFunctionState> 123/// In addition to storing the <see cref="VisitResult"/>, also stores the <see cref="LocalState"/> 130public readonly Optional<LocalState> StateForLambda; 135public VisitArgumentResult(VisitResult visitResult, Optional<LocalState> stateForLambda) 224/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, Optional&lt;LocalState&gt;,bool, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 589void enforceMemberNotNull(SyntaxNode? syntaxOpt, LocalState state) 671void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis) 758void enforceMemberNotNullOnMember(SyntaxNode? syntaxOpt, LocalState state, MethodSymbol method, string memberName) 804void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members, LocalState state, LocalState otherState) 816void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense, LocalState state) 831void reportMemberIfBadConditionalState(SyntaxNode? syntaxOpt, bool sense, Symbol member, LocalState state) 840bool memberHasBadState(Symbol member, LocalState state) 1143private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt, LocalState state) 1183private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense, LocalState stateWhen) 1196private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense, LocalState stateWhen) 1205bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense, LocalState stateWhen) 1243private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt, LocalState state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam) 1543Analyze(walker, symbol, diagnostics: null, LocalState.Create(localState), snapshotBuilderOpt: newSnapshotBuilder); 1660var localState = LocalState.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables); 1708Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<LocalState>)default : LocalState.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis); 1725Optional<LocalState> initialState, 1819private NullableFlowState GetState(ref LocalState state, int slot) 1828private void SetState(ref LocalState state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false) 1837private void NormalizeIfNeeded(ref LocalState state, int slot, bool useNotNullsAsDefault) 1842protected override void Normalize(ref LocalState state) 1850private NullableFlowState GetDefaultState(ref LocalState state, int slot) 2620private void SetStateAndTrackForFinally(ref LocalState state, int slot, NullableFlowState newState) 2626var tryState = NonMonotonicState.Value; 2635protected override void JoinTryBlockState(ref LocalState self, ref LocalState other) 2637var tryState = other.GetStateForVariables(self.Id); 2677protected override LocalState TopState() 2679var state = LocalState.ReachableState(_variables); 2684protected override LocalState UnreachableState() 2686return LocalState.UnreachableState(_variables); 2689protected override LocalState ReachableBottomState() 2692return LocalState.ReachableStateWithNotNulls(_variables); 2728var parameterDefaultsNotAssignedState = State.Clone(); 2853var joinedState = this.StateWhenTrue.Clone(); 3024var state = TopState(); 3025var startingState = localFunctionState.StartingState; 3066LocalState state, 3092var oldState = this.State; 3162var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3278var currentState = State; 4485var stateAfterLeft = this.State; 4488var stateWhenNotNull = this.State; 4544LocalState getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull) 4546LocalState stateWhenNotNull; 4582var stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull); 4839ref LocalState stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse; 4845protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref LocalState shortCircuitState) 4950private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref LocalState stateToUpdate) 4958private void LearnFromNonNullTest(BoundExpression expression, ref LocalState state) 4981private void LearnFromNonNullTest(int slot, ref LocalState state) 4986private void LearnFromNullTest(BoundExpression expression, ref LocalState state) 5004private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref LocalState state, bool markDependentSlotsNotNull) 5024private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref LocalState state, int depth = 2) 5105var leftState = this.State.Clone(); 5308var savedState = this.State.Clone(); 5417var consequenceState = this.StateWhenTrue; 5418var alternativeState = this.StateWhenFalse; 5518BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative, LocalState consequenceState, LocalState alternativeState, 5565LocalState consequenceState, 5566LocalState alternativeState, 5586(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 5599(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand) 5614LocalState state, 6413void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref LocalState state) 6426void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref LocalState state) 6497var savedState = (argument.Kind == BoundKind.Lambda) ? this.State.Clone() : default(Optional<LocalState>); 6813var originalWhenFalse = StateWhenFalse.Clone(); 6819var newWhenTrue = State.Clone(); 6980private static VariableState GetVariableState(Variables variables, LocalState localState) 7143BoundExpression getArgumentForMethodTypeInference(BoundExpression argument, TypeWithAnnotations argumentType, Optional<LocalState> lambdaState) 7558var savedState = this.State.Clone(); 7921Optional<LocalState> stateForLambda = default, 8966private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<LocalState> initialState = default) 10434protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref LocalState leftTrue, ref LocalState leftFalse) 10595LocalState stateWhenNotNull; 11087protected override void VisitCatchBlock(BoundCatchBlock node, ref LocalState finallyState) 11203protected override string Dump(LocalState state) 11208protected override bool Meet(ref LocalState self, ref LocalState other) 11225protected override bool Join(ref LocalState self, ref LocalState other) 11262private LocalState CloneAndUnsplit(ref PossiblyConditionalState conditionalState) 11269var state = conditionalState.StateWhenTrue.Clone(); 11311internal LocalState Value; 11313internal Boxed(LocalState value) 11334internal static LocalState Create(LocalStateSnapshot snapshot) 11349public static LocalState ReachableState(Variables variables) 11354public static LocalState UnreachableState(Variables variables) 11359public static LocalState ReachableStateWithNotNulls(Variables variables) 11383private static LocalState CreateReachableOrUnreachableState(Variables variables, bool reachable) 11392public LocalState CreateNestedMethodState(Variables variables) 11421bool hasVariableCore(ref LocalState state, int id, int index) 11439static bool hasValue(ref LocalState state, int slot) 11449static bool hasValueCore(ref LocalState state, int id, int index) 11574internal LocalState GetStateForVariables(int id) 11576var state = this; 11588public LocalState Clone() 11594public bool Join(in LocalState other) 11620public bool Meet(in LocalState other) 11711public LocalState StartingState; 11712public LocalFunctionState(LocalState unreachableState) 11723return new LocalFunctionState(LocalState.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
211internal void TakeIncrementalSnapshot(BoundNode? node, LocalState currentState)
FlowAnalysis\NullableWalker_Patterns.cs (21)
37var currentState = State; 235protected override LocalState VisitSwitchStatementDispatch(BoundSwitchStatement node) 273var afterSwitchState = labelStateMap.TryGetValue(node.BreakLabel, out var stateAndReachable) ? stateAndReachable.state : UnreachableState(); 301public LocalState State; 302public LocalState StateWhenTrue; 303public LocalState StateWhenFalse; 306public PossiblyConditionalState(LocalState stateWhenTrue, LocalState stateWhenFalse) 314public PossiblyConditionalState(LocalState state) 336private PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> LearnFromDecisionDag( 378var labelStateMap = PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)>.GetInstance(); 689void learnFromNonNullTest(int inputSlot, ref LocalState state) 764void gotoNode(BoundDecisionDagNode node, LocalState state, bool believedReachable) 853var endState = UnreachableState(); 942PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap, 956var armState = getStateForArm(arm, labelStateMap); 987PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap, 999LocalState getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (LocalState state, bool believedReachable)> labelStateMap) 1016var trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState(); 1017var falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();