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); 3289Join(ref this.State, ref afterConsequenceWhenTrue); 3351Join(ref this.State, ref state); 3624this.State = savedState; 3741Join(ref this.State, ref leftState); 3833Join(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); 2400LearnFromNonNullTest(value, ref State); 2603SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2713GetState(ref this.State, valueMemberSlot) : 2717SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2795SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 2878Join(ref State, ref parameterDefaultsNotAssignedState); 2893SetState(ref this.State, slot, state); 3322this.State = state.CreateNestedMethodState(_variables); 3385this.State = oldState; 3513SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 4079SetState(ref this.State, slot, resultState); 4297if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5202LearnFromNonNullTest(operand, ref State); 5619LearnFromNullTest(leftOperand, ref this.State); 5631SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 5641Join(ref this.State, ref leftState); 5668LearnFromNullTest(leftOperand, ref this.State); 5866Join(ref savedState, ref State); 5892LearnFromNonNullTest(slot, ref State); 5898Join(ref this.State, ref savedState); 5919LearnFromNonNullTest(slot, ref State); 5963Join(ref this.State, ref consequenceState); 7227applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7466LearnFromNonNullTest(argumentNoConversion, ref State); 7772LearnFromNullTest(argument, ref State); 7778LearnFromNonNullTest(argument, ref State); 8224NullableFlowState state = GetState(ref this.State, slot); 8504SetState(ref this.State, slot, NullableFlowState.NotNull); 8644SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8661SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8688SetState(ref this.State, targetFieldSlot, convertedType.State); 8999LearnFromNonNullTest(conversionOperand, ref State); 9097LearnFromNonNullTest(conversionOperand, ref State); 9482LearnFromNonNullTest(conversionOperand, ref State); 9807LearnFromNonNullTest(arg, ref State); 10855var state = GetState(ref this.State, slot); 11224SetState(ref this.State, slot, state); 11564SetState(ref this.State, slot, NullableFlowState.NotNull); 11770SetState(ref this.State, memberSlot, 11771node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 11881LearnFromNonNullTest(receiverOpt, ref this.State); 12085SetState(ref this.State, slot, NullableFlowState.NotNull); 12246Join(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(); 3230PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3238PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3283var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3341PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3352_labels[label] = this.State.Clone(); 3407PendingBranches.Add(new PendingBranch(node, this.State, null)); 3438PendingBranches.Add(new PendingBranch(node, this.State, null)); 3446PendingBranches.Add(new PendingBranch(node, this.State, null)); 3473var savedState = this.State; 3619TLocalState savedState = savedState = this.State.Clone(); 3725var savedState = this.State.Clone(); 3727leftState = this.State.Clone(); 3734var savedState = this.State.Clone(); 3736leftState = this.State.Clone(); 3827TLocalState initialState = this.State.Clone(); 3829TLocalState 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); 1823finalNullableState = GetVariableState(walker._variables, walker.State); 1891_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2590if (this.State.Reachable) 2869var parameterDefaultsNotAssignedState = State.Clone(); 2949PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3000PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3006EnforceNotNullIfNotNull(node.Syntax, this.State, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3320var oldState = this.State; 3345PendingBranches.Add(new PendingBranch(null, this.State, null)); 3352enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3354EnforceParameterNotNullOnExit(null, this.State); 3424var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3540var currentState = State; 4978var stateAfterLeft = this.State; 4981var stateWhenNotNull = this.State; 4994? (State, stateWhenNotNull) 4995: (stateWhenNotNull, State)); 5078? (State, stateWhenNotNull) 5079: (stateWhenNotNull, State)); 5617var leftState = this.State.Clone(); 5835var savedState = this.State.Clone(); 5961consequenceState = this.State; 6213=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 7685var newWhenTrue = State.Clone(); 7691SetConditionalState(newWhenTrue, whenFalse: State); 8478var savedState = this.State.Clone(); 9923var stateForLambda = this.State.Clone(); 9949initialState.HasValue ? initialState.Value : State.Clone(), 10492if (this.State.Reachable) 11596SetConditionalState(stateWhenNotNull, State); 11866if (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;