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); 2588Meet(ref stateWhenNotNull, ref State); 2711Join(ref State, ref shortCircuitState); 2746Join(ref shortCircuitState, ref State); 2962Join(ref this.State, ref savedState); 3093Join(ref savedState, ref State); 3100State = savedState; 3101Join(ref State, ref stateWhenNotNull); 3120Join(ref this.State, ref savedState); 3126Join(ref this.State, ref savedState); 3142Join(ref this.State, ref savedState); 3146Join(ref this.State, ref savedState); 3280Join(ref this.State, ref afterConsequenceWhenTrue); 3342Join(ref this.State, ref state); 3615this.State = savedState; 3732Join(ref this.State, ref leftState); 3824Join(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)
841SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 1108SetState(ref this.State, memberSlot, NullableFlowState.MaybeNull); 2337LearnFromNonNullTest(value, ref State); 2540SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2650GetState(ref this.State, valueMemberSlot) : 2654SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2732SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 2815Join(ref State, ref parameterDefaultsNotAssignedState); 2830SetState(ref this.State, slot, state); 3259this.State = state.CreateNestedMethodState(_variables); 3322this.State = oldState; 3450SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 4014SetState(ref this.State, slot, resultState); 4231if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5136LearnFromNonNullTest(operand, ref State); 5553LearnFromNullTest(leftOperand, ref this.State); 5565SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 5575Join(ref this.State, ref leftState); 5602LearnFromNullTest(leftOperand, ref this.State); 5800Join(ref savedState, ref State); 5826LearnFromNonNullTest(slot, ref State); 5832Join(ref this.State, ref savedState); 5853LearnFromNonNullTest(slot, ref State); 5897Join(ref this.State, ref consequenceState); 7155applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7394LearnFromNonNullTest(argumentNoConversion, ref State); 7700LearnFromNullTest(argument, ref State); 7706LearnFromNonNullTest(argument, ref State); 8152NullableFlowState state = GetState(ref this.State, slot); 8432SetState(ref this.State, slot, NullableFlowState.NotNull); 8572SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8589SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8616SetState(ref this.State, targetFieldSlot, convertedType.State); 8927LearnFromNonNullTest(conversionOperand, ref State); 9025LearnFromNonNullTest(conversionOperand, ref State); 9410LearnFromNonNullTest(conversionOperand, ref State); 9735LearnFromNonNullTest(arg, ref State); 10783var state = GetState(ref this.State, slot); 11152SetState(ref this.State, slot, state); 11492SetState(ref this.State, slot, NullableFlowState.NotNull); 11698SetState(ref this.State, memberSlot, 11699node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 11809LearnFromNonNullTest(receiverOpt, ref this.State); 12013SetState(ref this.State, slot, NullableFlowState.NotNull); 12174Join(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)); 2593? (State, stateWhenNotNull) 2594: (stateWhenNotNull, State)); 2646? (State, stateWhenNotNull) 2647: (stateWhenNotNull, State)); 2702TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2736shortCircuitState = State.Clone(); 2794PendingBranches.Add(new PendingBranch(node, this.State, null)); 2849bodyState = this.State; 2871var breakState = this.State.Clone(); 2880PendingBranches.Add(new PendingBranch(node, this.State, null)); 2906SetConditionalState(stateWhenNotNull, State); 2947savedState = State.Clone(); 3047stateWhenNotNull = this.State.Clone(); 3063stateWhenNotNull = this.State.Clone(); 3068var savedState = this.State.Clone(); 3099stateWhenNotNull = State; 3117var savedState = this.State.Clone(); 3124savedState = this.State.Clone(); 3139var savedState = this.State.Clone(); 3144savedState = this.State.Clone(); 3221PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3229PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3274var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3332PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3343_labels[label] = this.State.Clone(); 3398PendingBranches.Add(new PendingBranch(node, this.State, null)); 3429PendingBranches.Add(new PendingBranch(node, this.State, null)); 3437PendingBranches.Add(new PendingBranch(node, this.State, null)); 3464var savedState = this.State; 3610TLocalState savedState = savedState = this.State.Clone(); 3716var savedState = this.State.Clone(); 3718leftState = this.State.Clone(); 3725var savedState = this.State.Clone(); 3727leftState = this.State.Clone(); 3818TLocalState initialState = this.State.Clone(); 3820TLocalState 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)
491return $"{{{GetType().Name} {Dump(State)}{"}"}"; 597_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode, State); 604enforceMemberNotNull(syntaxOpt: null, this.State); 605EnforceParameterNotNullOnExit(syntaxOpt: null, this.State); 1760finalNullableState = GetVariableState(walker._variables, walker.State); 1828_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2527if (this.State.Reachable) 2806var parameterDefaultsNotAssignedState = State.Clone(); 2886PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2937PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2943EnforceNotNullIfNotNull(node.Syntax, this.State, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3257var oldState = this.State; 3282PendingBranches.Add(new PendingBranch(null, this.State, null)); 3289enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3291EnforceParameterNotNullOnExit(null, this.State); 3361var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3477var currentState = State; 4912var stateAfterLeft = this.State; 4915var stateWhenNotNull = this.State; 4928? (State, stateWhenNotNull) 4929: (stateWhenNotNull, State)); 5012? (State, stateWhenNotNull) 5013: (stateWhenNotNull, State)); 5551var leftState = this.State.Clone(); 5769var savedState = this.State.Clone(); 5895consequenceState = this.State; 6147=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 7613var newWhenTrue = State.Clone(); 7619SetConditionalState(newWhenTrue, whenFalse: State); 8406var savedState = this.State.Clone(); 9851var stateForLambda = this.State.Clone(); 9877initialState.HasValue ? initialState.Value : State.Clone(), 10420if (this.State.Reachable) 11524SetConditionalState(stateWhenNotNull, State); 11794if (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;