114 writes to State
Microsoft.CodeAnalysis.CSharp (114)
FlowAnalysis\AbstractFlowPass.cs (31)
133State = default(TLocalState); 143State = newState; 442this.State = initialState.HasValue ? initialState.Value : TopState(); 546this.State = UnreachableState(); 698Join(ref this.State, ref previousState); 710if (Join(ref oldState, ref this.State)) 741JoinPendingBranches(ref this.State, continueLabel); 1189Join(ref this.State, ref shortCircuitState); 1375this.State = savedState; 1408Join(ref State, ref localFunctionState.StateFromBottom); 1412Meet(ref State, ref localFunctionState.StateFromTop); 1809Join(ref this.State, ref trueState); 1837Join(ref endState, ref this.State); 1883Meet(ref endState, ref this.State); 1896Meet(ref stateToUpdate, ref this.State); 2596Meet(ref stateWhenNotNull, ref State); 2721Join(ref State, ref shortCircuitState); 2756Join(ref shortCircuitState, ref State); 2972Join(ref this.State, ref savedState); 3103Join(ref savedState, ref State); 3110State = savedState; 3111Join(ref State, ref stateWhenNotNull); 3130Join(ref this.State, ref savedState); 3136Join(ref this.State, ref savedState); 3152Join(ref this.State, ref savedState); 3156Join(ref this.State, ref savedState); 3295Join(ref this.State, ref afterConsequenceWhenTrue); 3357Join(ref this.State, ref state); 3630this.State = savedState; 3747Join(ref this.State, ref leftState); 3839Join(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; 1161if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1757SetSlotAssigned(slot, ref this.State); 1798SetSlotUnassigned(slot, ref this.State); 2447this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2457Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2460this.State = pending.State; 2471Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2474this.State = stateAfterLambda;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
79Normalize(ref this.State);
FlowAnalysis\LocalDataFlowPass.cs (1)
142Normalize(ref this.State);
FlowAnalysis\NullableWalker.cs (46)
855SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 1182SetState(ref this.State, memberSlot, NullableFlowState.MaybeNull); 2435LearnFromNonNullTest(value, ref State); 2638SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2751GetState(ref this.State, valueMemberSlot) : 2755SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2849SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 2972Join(ref State, ref parameterDefaultsNotAssignedState); 2987SetState(ref this.State, slot, state); 3417this.State = state.CreateNestedMethodState(_variables); 3480this.State = oldState; 3608SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 4174SetState(ref this.State, slot, resultState); 4392if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5358LearnFromNonNullTest(operand, ref State); 5711LearnFromNullTest(leftOperand, ref this.State); 5723SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 5733Join(ref this.State, ref leftState); 5760LearnFromNullTest(leftOperand, ref this.State); 5959Join(ref savedState, ref State); 5985LearnFromNonNullTest(slot, ref State); 5991Join(ref this.State, ref savedState); 6012LearnFromNonNullTest(slot, ref State); 6056Join(ref this.State, ref consequenceState); 7443applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7682LearnFromNonNullTest(argumentNoConversion, ref State); 7988LearnFromNullTest(argument, ref State); 7994LearnFromNonNullTest(argument, ref State); 8447NullableFlowState state = GetState(ref this.State, slot); 8728SetState(ref this.State, slot, NullableFlowState.NotNull); 8868SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8885SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 8912SetState(ref this.State, targetFieldSlot, convertedType.State); 9223LearnFromNonNullTest(conversionOperand, ref State); 9321LearnFromNonNullTest(conversionOperand, ref State); 9706LearnFromNonNullTest(conversionOperand, ref State); 10031LearnFromNonNullTest(arg, ref State); 11142var state = GetState(ref this.State, slot); 11511SetState(ref this.State, slot, state); 11851SetState(ref this.State, slot, NullableFlowState.NotNull); 12057SetState(ref this.State, memberSlot, 12058node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 12168LearnFromNonNullTest(receiverOpt, ref this.State); 12372SetState(ref this.State, slot, NullableFlowState.NotNull); 12533Join(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)
150SetConditionalState(State, State.Clone()); 229: Dump(this.State); 636SetConditionalState(this.State, UnreachableState()); 641SetConditionalState(UnreachableState(), this.State); 701_loopHeadState[node] = this.State.Clone(); 937? (State, stateWhenNotNull) 938: (stateWhenNotNull, State)); 964SetConditionalState(UnreachableState(), this.State); 969SetConditionalState(this.State, UnreachableState()); 1182TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 1340savedState = this.State.Clone(); 1785trueState = this.State; 1825var initialState = this.State.Clone(); 1832var endState = this.State; 2025PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2333PendingBranches.Add(new PendingBranch(node, this.State, null)); 2601? (State, stateWhenNotNull) 2602: (stateWhenNotNull, State)); 2656? (State, stateWhenNotNull) 2657: (stateWhenNotNull, State)); 2712TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2746shortCircuitState = State.Clone(); 2804PendingBranches.Add(new PendingBranch(node, this.State, null)); 2859bodyState = this.State; 2881var breakState = this.State.Clone(); 2890PendingBranches.Add(new PendingBranch(node, this.State, null)); 2916SetConditionalState(stateWhenNotNull, State); 2957savedState = State.Clone(); 3057stateWhenNotNull = this.State.Clone(); 3073stateWhenNotNull = this.State.Clone(); 3078var savedState = this.State.Clone(); 3109stateWhenNotNull = State; 3127var savedState = this.State.Clone(); 3134savedState = this.State.Clone(); 3149var savedState = this.State.Clone(); 3154savedState = this.State.Clone(); 3236PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3244PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3289var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3347PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3358_labels[label] = this.State.Clone(); 3413PendingBranches.Add(new PendingBranch(node, this.State, null)); 3444PendingBranches.Add(new PendingBranch(node, this.State, null)); 3452PendingBranches.Add(new PendingBranch(node, this.State, null)); 3479var savedState = this.State; 3625TLocalState savedState = savedState = this.State.Clone(); 3731var savedState = this.State.Clone(); 3733leftState = this.State.Clone(); 3740var savedState = this.State.Clone(); 3742leftState = this.State.Clone(); 3833TLocalState initialState = this.State.Clone(); 3835TLocalState 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; 467if (Diagnostics != null && this.State.Reachable) 480if (!this.State.IsAssigned(thisSlot)) 491if (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); 1947if (!this.State.Reachable) 1972if (slot > 0 && !this.State.IsAssigned(slot)) 1983LocalState result = this.State.Clone(); 1997SetConditionalState(this.State, whenFail); 2445LocalState stateAfterLambda = this.State; 2447this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2604if (!this.State.Reachable) return; 2746if (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)}{"}"}"; 611_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode, State); 618enforceMemberNotNull(syntaxOpt: null, this.State); 619EnforceParameterNotNullOnExit(syntaxOpt: null, this.State); 1858finalNullableState = GetVariableState(walker._variables, walker.State); 1926_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2625if (this.State.Reachable) 2963var parameterDefaultsNotAssignedState = State.Clone(); 3043PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3094PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3101EnforceNotNullIfNotNull(node.Syntax, this.State, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3415var oldState = this.State; 3440PendingBranches.Add(new PendingBranch(null, this.State, null)); 3447enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3449EnforceParameterNotNullOnExit(null, this.State); 3519var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3635var currentState = State; 5075var stateAfterLeft = this.State; 5078var stateWhenNotNull = this.State; 5091? (State, stateWhenNotNull) 5092: (stateWhenNotNull, State)); 5175? (State, stateWhenNotNull) 5176: (stateWhenNotNull, State)); 5709var leftState = this.State.Clone(); 5928var savedState = this.State.Clone(); 6054consequenceState = this.State; 6306=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 7901var newWhenTrue = State.Clone(); 7907SetConditionalState(newWhenTrue, whenFalse: State); 8702var savedState = this.State.Clone(); 10159var stateForLambda = this.State.Clone(); 10185initialState.HasValue ? initialState.Value : State.Clone(), 10745if (this.State.Reachable) 11883SetConditionalState(stateWhenNotNull, State); 12153if (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;