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); 1810Join(ref this.State, ref trueState); 1838Join(ref endState, ref this.State); 1884Meet(ref endState, ref this.State); 1897Meet(ref stateToUpdate, ref this.State); 2597Meet(ref stateWhenNotNull, ref State); 2722Join(ref State, ref shortCircuitState); 2757Join(ref shortCircuitState, ref State); 2973Join(ref this.State, ref savedState); 3104Join(ref savedState, ref State); 3111State = savedState; 3112Join(ref State, ref stateWhenNotNull); 3131Join(ref this.State, ref savedState); 3137Join(ref this.State, ref savedState); 3153Join(ref this.State, ref savedState); 3157Join(ref this.State, ref savedState); 3296Join(ref this.State, ref afterConsequenceWhenTrue); 3358Join(ref this.State, ref state); 3631this.State = savedState; 3748Join(ref this.State, ref leftState); 3840Join(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); 392this.State = returnBranch.State; 396Join(ref savedState, ref this.State); 399this.State = savedState; 1176if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1772SetSlotAssigned(slot, ref this.State); 1813SetSlotUnassigned(slot, ref this.State); 2462this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2472Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2475this.State = pending.State; 2486Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2489this.State = stateAfterLambda;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
79Normalize(ref this.State);
FlowAnalysis\LocalDataFlowPass.cs (1)
142Normalize(ref this.State);
FlowAnalysis\NullableWalker.cs (46)
851SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 1178SetState(ref this.State, memberSlot, NullableFlowState.MaybeNull); 2420LearnFromNonNullTest(value, ref State); 2623SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2736GetState(ref this.State, valueMemberSlot) : 2740SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2834SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 2957Join(ref State, ref parameterDefaultsNotAssignedState); 2972SetState(ref this.State, slot, state); 3401this.State = state.CreateNestedMethodState(_variables); 3464this.State = oldState; 3592SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 4158SetState(ref this.State, slot, resultState); 4376if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5283LearnFromNonNullTest(operand, ref State); 5700LearnFromNullTest(leftOperand, ref this.State); 5712SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 5722Join(ref this.State, ref leftState); 5749LearnFromNullTest(leftOperand, ref this.State); 5947Join(ref savedState, ref State); 5973LearnFromNonNullTest(slot, ref State); 5979Join(ref this.State, ref savedState); 6000LearnFromNonNullTest(slot, ref State); 6044Join(ref this.State, ref consequenceState); 7316applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7555LearnFromNonNullTest(argumentNoConversion, ref State); 7861LearnFromNullTest(argument, ref State); 7867LearnFromNonNullTest(argument, ref State); 8313NullableFlowState state = GetState(ref this.State, slot); 8595SetState(ref this.State, slot, NullableFlowState.NotNull); 8735SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8752SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8779SetState(ref this.State, targetFieldSlot, convertedType.State); 9092LearnFromNonNullTest(conversionOperand, ref State); 9190LearnFromNonNullTest(conversionOperand, ref State); 9575LearnFromNonNullTest(conversionOperand, ref State); 9900LearnFromNonNullTest(arg, ref State); 10964var state = GetState(ref this.State, slot); 11333SetState(ref this.State, slot, state); 11673SetState(ref this.State, slot, NullableFlowState.NotNull); 11879SetState(ref this.State, memberSlot, 11880node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 11990LearnFromNonNullTest(receiverOpt, ref this.State); 12194SetState(ref this.State, slot, NullableFlowState.NotNull); 12355Join(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(); 1786trueState = this.State; 1826var initialState = this.State.Clone(); 1833var endState = this.State; 2026PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2334PendingBranches.Add(new PendingBranch(node, this.State, null)); 2602? (State, stateWhenNotNull) 2603: (stateWhenNotNull, State)); 2657? (State, stateWhenNotNull) 2658: (stateWhenNotNull, State)); 2713TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2747shortCircuitState = State.Clone(); 2805PendingBranches.Add(new PendingBranch(node, this.State, null)); 2860bodyState = this.State; 2882var breakState = this.State.Clone(); 2891PendingBranches.Add(new PendingBranch(node, this.State, null)); 2917SetConditionalState(stateWhenNotNull, State); 2958savedState = State.Clone(); 3058stateWhenNotNull = this.State.Clone(); 3074stateWhenNotNull = this.State.Clone(); 3079var savedState = this.State.Clone(); 3110stateWhenNotNull = State; 3128var savedState = this.State.Clone(); 3135savedState = this.State.Clone(); 3150var savedState = this.State.Clone(); 3155savedState = this.State.Clone(); 3237PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3245PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3290var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3348PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3359_labels[label] = this.State.Clone(); 3414PendingBranches.Add(new PendingBranch(node, this.State, null)); 3445PendingBranches.Add(new PendingBranch(node, this.State, null)); 3453PendingBranches.Add(new PendingBranch(node, this.State, null)); 3480var savedState = this.State; 3626TLocalState savedState = savedState = this.State.Clone(); 3732var savedState = this.State.Clone(); 3734leftState = this.State.Clone(); 3741var savedState = this.State.Clone(); 3743leftState = this.State.Clone(); 3834TLocalState initialState = this.State.Clone(); 3836TLocalState 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)
389var savedState = this.State; 482if (Diagnostics != null && this.State.Reachable) 495if (!this.State.IsAssigned(thisSlot)) 506if (fieldSlot == -1 || !this.State.IsAssigned(fieldSlot)) 1173if (this.State.Reachable) 1176if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1177if (slot > 0 && !this.State.IsAssigned(slot)) 1287if (slot == -1 || !State.IsAssigned(slot)) 1385if (this.State.Reachable && !IsAssigned(expr, out int unassignedSlot)) 1490return this.State.IsAssigned(unassignedSlot); 1565SetSlotState(slot, assigned: written || !this.State.Reachable); 1578SetSlotState(slot, assigned: written || !this.State.Reachable); 1962if (!this.State.Reachable) 1987if (slot > 0 && !this.State.IsAssigned(slot)) 1998LocalState result = this.State.Clone(); 2012SetConditionalState(this.State, whenFail); 2460LocalState stateAfterLambda = this.State; 2462this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2619if (!this.State.Reachable) return; 2761if (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)
500return $"{{{GetType().Name} {Dump(State)}{"}"}"; 607_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode, State); 614enforceMemberNotNull(syntaxOpt: null, this.State); 615EnforceParameterNotNullOnExit(syntaxOpt: null, this.State); 1843finalNullableState = GetVariableState(walker._variables, walker.State); 1911_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2610if (this.State.Reachable) 2948var parameterDefaultsNotAssignedState = State.Clone(); 3028PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3079PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3085EnforceNotNullIfNotNull(node.Syntax, this.State, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3399var oldState = this.State; 3424PendingBranches.Add(new PendingBranch(null, this.State, null)); 3431enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3433EnforceParameterNotNullOnExit(null, this.State); 3503var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3619var currentState = State; 5059var stateAfterLeft = this.State; 5062var stateWhenNotNull = this.State; 5075? (State, stateWhenNotNull) 5076: (stateWhenNotNull, State)); 5159? (State, stateWhenNotNull) 5160: (stateWhenNotNull, State)); 5698var leftState = this.State.Clone(); 5916var savedState = this.State.Clone(); 6042consequenceState = this.State; 6294=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 7774var newWhenTrue = State.Clone(); 7780SetConditionalState(newWhenTrue, whenFalse: State); 8569var savedState = this.State.Clone(); 10017var stateForLambda = this.State.Clone(); 10043initialState.HasValue ? initialState.Value : State.Clone(), 10601if (this.State.Reachable) 11705SetConditionalState(stateWhenNotNull, State); 11975if (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;