114 writes to State
Microsoft.CodeAnalysis.CSharp (114)
FlowAnalysis\AbstractFlowPass.cs (31)
134State = default(TLocalState); 144State = newState; 443this.State = initialState.HasValue ? initialState.Value : TopState(); 547this.State = UnreachableState(); 699Join(ref this.State, ref previousState); 711if (Join(ref oldState, ref this.State)) 742JoinPendingBranches(ref this.State, continueLabel); 1190Join(ref this.State, ref shortCircuitState); 1376this.State = savedState; 1409Join(ref State, ref localFunctionState.StateFromBottom); 1413Meet(ref State, ref localFunctionState.StateFromTop); 1803Join(ref this.State, ref trueState); 1831Join(ref endState, ref this.State); 1877Meet(ref endState, ref this.State); 1890Meet(ref stateToUpdate, ref this.State); 2590Meet(ref stateWhenNotNull, ref State); 2715Join(ref State, ref shortCircuitState); 2750Join(ref shortCircuitState, ref State); 2966Join(ref this.State, ref savedState); 3097Join(ref savedState, ref State); 3104State = savedState; 3105Join(ref State, ref stateWhenNotNull); 3124Join(ref this.State, ref savedState); 3130Join(ref this.State, ref savedState); 3146Join(ref this.State, ref savedState); 3150Join(ref this.State, ref savedState); 3284Join(ref this.State, ref afterConsequenceWhenTrue); 3346Join(ref this.State, ref state); 3619this.State = savedState; 3736Join(ref this.State, ref leftState); 3828Join(ref this.State, ref afterBlock);
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (4)
83this.State = this.TopState(); 122this.State = pending.State; 131Join(ref stateAtReturn, ref this.State); 149this.State = savedState;
FlowAnalysis\AbstractFlowPass_Switch.cs (2)
31Join(ref afterSwitchState, ref this.State); 178Join(ref endState, ref this.State);
FlowAnalysis\AbstractRegionControlFlowPass.cs (5)
35this.State = TopState(); 41Join(ref finalState, ref this.State); 44this.State = returnBranch.State; 45Join(ref finalState, ref this.State); 48this.State = finalState;
FlowAnalysis\AlwaysAssignedWalker.cs (1)
116this.State = TopState();
FlowAnalysis\DataFlowsInWalker.cs (1)
74this.State = ResetState(this.State);
FlowAnalysis\DefiniteAssignment.cs (14)
188State = new LocalState(BitVector.Empty); 207State = new LocalState(BitVector.Empty); 229State = new LocalState(BitVector.Empty); 385this.State = returnBranch.State; 388Join(ref savedState, ref this.State); 391this.State = savedState; 1161if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1757SetSlotAssigned(slot, ref this.State); 1798SetSlotUnassigned(slot, ref this.State); 2435this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2445Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2448this.State = pending.State; 2459Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2462this.State = stateAfterLambda;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
79Normalize(ref this.State);
FlowAnalysis\LocalDataFlowPass.cs (1)
142Normalize(ref this.State);
FlowAnalysis\NullableWalker.cs (46)
842SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 1169SetState(ref this.State, memberSlot, NullableFlowState.MaybeNull); 2398LearnFromNonNullTest(value, ref State); 2601SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2711GetState(ref this.State, valueMemberSlot) : 2715SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2793SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 2876Join(ref State, ref parameterDefaultsNotAssignedState); 2891SetState(ref this.State, slot, state); 3320this.State = state.CreateNestedMethodState(_variables); 3383this.State = oldState; 3511SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 4075SetState(ref this.State, slot, resultState); 4292if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5197LearnFromNonNullTest(operand, ref State); 5614LearnFromNullTest(leftOperand, ref this.State); 5626SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 5636Join(ref this.State, ref leftState); 5663LearnFromNullTest(leftOperand, ref this.State); 5861Join(ref savedState, ref State); 5887LearnFromNonNullTest(slot, ref State); 5893Join(ref this.State, ref savedState); 5914LearnFromNonNullTest(slot, ref State); 5958Join(ref this.State, ref consequenceState); 7216applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7455LearnFromNonNullTest(argumentNoConversion, ref State); 7761LearnFromNullTest(argument, ref State); 7767LearnFromNonNullTest(argument, ref State); 8213NullableFlowState state = GetState(ref this.State, slot); 8493SetState(ref this.State, slot, NullableFlowState.NotNull); 8633SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8650SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8677SetState(ref this.State, targetFieldSlot, convertedType.State); 8988LearnFromNonNullTest(conversionOperand, ref State); 9086LearnFromNonNullTest(conversionOperand, ref State); 9471LearnFromNonNullTest(conversionOperand, ref State); 9796LearnFromNonNullTest(arg, ref State); 10844var state = GetState(ref this.State, slot); 11213SetState(ref this.State, slot, state); 11553SetState(ref this.State, slot, NullableFlowState.NotNull); 11759SetState(ref this.State, memberSlot, 11760node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 11870LearnFromNonNullTest(receiverOpt, ref this.State); 12074SetState(ref this.State, slot, NullableFlowState.NotNull); 12235Join(ref State, ref other.State);
FlowAnalysis\NullableWalker_Patterns.cs (8)
172LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 185LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 192LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 481SetState(ref State, outputSlot, NullableFlowState.NotNull); 577SetState(ref this.State, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null 680var tempState = GetState(ref this.State, tempSlot); 795Join(ref this.State, ref stateAndReachable.state.State); 937Join(ref endState, ref this.State);
144 references to State
Microsoft.CodeAnalysis.CSharp (144)
FlowAnalysis\AbstractFlowPass.cs (54)
151SetConditionalState(State, State.Clone()); 230: Dump(this.State); 637SetConditionalState(this.State, UnreachableState()); 642SetConditionalState(UnreachableState(), this.State); 702_loopHeadState[node] = this.State.Clone(); 938? (State, stateWhenNotNull) 939: (stateWhenNotNull, State)); 965SetConditionalState(UnreachableState(), this.State); 970SetConditionalState(this.State, UnreachableState()); 1183TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 1341savedState = this.State.Clone(); 1779trueState = this.State; 1819var initialState = this.State.Clone(); 1826var endState = this.State; 2019PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2327PendingBranches.Add(new PendingBranch(node, this.State, null)); 2595? (State, stateWhenNotNull) 2596: (stateWhenNotNull, State)); 2650? (State, stateWhenNotNull) 2651: (stateWhenNotNull, State)); 2706TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2740shortCircuitState = State.Clone(); 2798PendingBranches.Add(new PendingBranch(node, this.State, null)); 2853bodyState = this.State; 2875var breakState = this.State.Clone(); 2884PendingBranches.Add(new PendingBranch(node, this.State, null)); 2910SetConditionalState(stateWhenNotNull, State); 2951savedState = State.Clone(); 3051stateWhenNotNull = this.State.Clone(); 3067stateWhenNotNull = this.State.Clone(); 3072var savedState = this.State.Clone(); 3103stateWhenNotNull = State; 3121var savedState = this.State.Clone(); 3128savedState = this.State.Clone(); 3143var savedState = this.State.Clone(); 3148savedState = this.State.Clone(); 3225PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3233PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3278var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3336PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3347_labels[label] = this.State.Clone(); 3402PendingBranches.Add(new PendingBranch(node, this.State, null)); 3433PendingBranches.Add(new PendingBranch(node, this.State, null)); 3441PendingBranches.Add(new PendingBranch(node, this.State, null)); 3468var savedState = this.State; 3614TLocalState savedState = savedState = this.State.Clone(); 3720var savedState = this.State.Clone(); 3722leftState = this.State.Clone(); 3729var savedState = this.State.Clone(); 3731leftState = this.State.Clone(); 3822TLocalState initialState = this.State.Clone(); 3824TLocalState afterBlock = this.State;
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (3)
82var savedState = this.State; 106PendingBranches.Add(new PendingBranch(null, this.State, null)); 119var stateAtReturn = this.State;
FlowAnalysis\AbstractFlowPass_Switch.cs (4)
44TLocalState initialState = this.State.Clone(); 69PendingBranches.Add(new PendingBranch(label, this.State, label.Label)); 134var state = this.State.Clone(); 158var dispatchState = this.State;
FlowAnalysis\AbstractRegionControlFlowPass.cs (1)
34LocalState finalState = this.State;
FlowAnalysis\AlwaysAssignedWalker.cs (1)
131_endOfRegionState = this.State.Clone();
FlowAnalysis\ControlFlowPass.cs (6)
109return new LocalState(false, this.State.Reported); 201return State.Alive; 263if (!this.State.Alive && 264!this.State.Reported && 270this.State.Reported = true; 377if (this.State.Alive)
FlowAnalysis\DataFlowsInWalker.cs (1)
74this.State = ResetState(this.State);
FlowAnalysis\DataFlowsOutWalker.cs (3)
82if (slot > 0 && !this.State.IsAssigned(slot)) 94if (this.State.Reachable && IsInside) 217if (State.Reachable)
FlowAnalysis\DefiniteAssignment.cs (21)
382var savedState = this.State; 459if (Diagnostics != null && this.State.Reachable) 472if (!this.State.IsAssigned(thisSlot)) 483if (fieldSlot == -1 || !this.State.IsAssigned(fieldSlot)) 1158if (this.State.Reachable) 1161if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1162if (slot > 0 && !this.State.IsAssigned(slot)) 1272if (slot == -1 || !State.IsAssigned(slot)) 1370if (this.State.Reachable && !IsAssigned(expr, out int unassignedSlot)) 1475return this.State.IsAssigned(unassignedSlot); 1550SetSlotState(slot, assigned: written || !this.State.Reachable); 1563SetSlotState(slot, assigned: written || !this.State.Reachable); 1935if (!this.State.Reachable) 1960if (slot > 0 && !this.State.IsAssigned(slot)) 1971LocalState result = this.State.Clone(); 1985SetConditionalState(this.State, whenFail); 2433LocalState stateAfterLambda = this.State; 2435this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2592if (!this.State.Reachable) return; 2734if (this.State.Reachable && !IsAssigned(node, out unassignedSlot))
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (4)
75if (this.State.Reachable) 77if (slot >= this.State.Assigned.Capacity) 82if (slot > 0 && !this.State.IsAssigned(slot)) 114if (fieldSlot > 0 && !State.IsAssigned(fieldSlot))
FlowAnalysis\DefinitelyAssignedWalker.cs (1)
81this.ProcessState(definitelyAssigned, this.State, state2opt: null);
FlowAnalysis\NullableWalker.cs (35)
492return $"{{{GetType().Name} {Dump(State)}{"}"}"; 598_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode, State); 605enforceMemberNotNull(syntaxOpt: null, this.State); 606EnforceParameterNotNullOnExit(syntaxOpt: null, this.State); 1821finalNullableState = GetVariableState(walker._variables, walker.State); 1889_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2588if (this.State.Reachable) 2867var parameterDefaultsNotAssignedState = State.Clone(); 2947PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2998PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3004EnforceNotNullIfNotNull(node.Syntax, this.State, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3318var oldState = this.State; 3343PendingBranches.Add(new PendingBranch(null, this.State, null)); 3350enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3352EnforceParameterNotNullOnExit(null, this.State); 3422var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3538var currentState = State; 4973var stateAfterLeft = this.State; 4976var stateWhenNotNull = this.State; 4989? (State, stateWhenNotNull) 4990: (stateWhenNotNull, State)); 5073? (State, stateWhenNotNull) 5074: (stateWhenNotNull, State)); 5612var leftState = this.State.Clone(); 5830var savedState = this.State.Clone(); 5956consequenceState = this.State; 6208=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 7674var newWhenTrue = State.Clone(); 7680SetConditionalState(newWhenTrue, whenFalse: State); 8467var savedState = this.State.Clone(); 9912var stateForLambda = this.State.Clone(); 9938initialState.HasValue ? initialState.Value : State.Clone(), 10481if (this.State.Reachable) 11585SetConditionalState(stateWhenNotNull, State); 11855if (receiverOpt != null && this.State.Reachable)
FlowAnalysis\NullableWalker_Patterns.cs (7)
37var currentState = State; 307PendingBranches.Add(new PendingBranch(label, this.State, label.Label)); 325if (!State.Reachable && label.WhenClause != null) 363: new PossiblyConditionalState(nullableWalker.State); 667labelStateMap.Add(d.Label, (this.State, nodeBelievedReachable)); 715gotoNode(w.WhenTrue, this.State, nodeBelievedReachable); 925if (!State.Reachable && arm.WhenClause != null)
FlowAnalysis\RegionReachableWalker.cs (3)
27endPointIsReachable = badRegion || walker._regionEndPointIsReachable.GetValueOrDefault(walker.State.Alive); 46_regionStartPointIsReachable = this.State.Alive; 52_regionEndPointIsReachable = this.State.Alive;