116 writes to State
Microsoft.CodeAnalysis.CSharp (116)
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; 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); 2618Meet(ref stateWhenNotNull, ref State); 2743Join(ref State, ref shortCircuitState); 2778Join(ref shortCircuitState, ref State); 2994Join(ref this.State, ref savedState); 3125Join(ref savedState, ref State); 3132State = savedState; 3133Join(ref State, ref stateWhenNotNull); 3152Join(ref this.State, ref savedState); 3158Join(ref this.State, ref savedState); 3174Join(ref this.State, ref savedState); 3178Join(ref this.State, ref savedState); 3317Join(ref this.State, ref afterConsequenceWhenTrue); 3379Join(ref this.State, ref state); 3652this.State = savedState; 3769Join(ref this.State, ref leftState); 3861Join(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)
117this.State = TopState();
FlowAnalysis\DataFlowsInWalker.cs (1)
74this.State = ResetState(this.State);
FlowAnalysis\DefiniteAssignment.cs (14)
189State = new LocalState(BitVector.Empty); 208State = new LocalState(BitVector.Empty); 230State = new LocalState(BitVector.Empty); 393this.State = returnBranch.State; 397Join(ref savedState, ref this.State); 400this.State = savedState; 1162if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1758SetSlotAssigned(slot, ref this.State); 1799SetSlotUnassigned(slot, ref this.State); 2440this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2450Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2453this.State = pending.State; 2464Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2467this.State = stateAfterLambda;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
79Normalize(ref this.State);
FlowAnalysis\LocalDataFlowPass.cs (1)
142Normalize(ref this.State);
FlowAnalysis\NullableWalker.cs (48)
861SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 1188SetState(ref this.State, memberSlot, NullableFlowState.MaybeNull); 2441LearnFromNonNullTest(value, ref State); 2644SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2757GetState(ref this.State, valueMemberSlot) : 2761SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2855SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 2978Join(ref State, ref parameterDefaultsNotAssignedState); 2993SetState(ref this.State, slot, state); 3423this.State = state.CreateNestedMethodState(_variables); 3486this.State = oldState; 3614SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 4234SetState(ref this.State, slot, resultState); 4453if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5481LearnFromNonNullTest(operand, ref State); 5834LearnFromNullTest(leftOperand, ref this.State); 5846SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 5856Join(ref this.State, ref leftState); 5883LearnFromNullTest(leftOperand, ref this.State); 6082Join(ref savedState, ref State); 6108LearnFromNonNullTest(slot, ref State); 6114Join(ref this.State, ref savedState); 6135LearnFromNonNullTest(slot, ref State); 6179Join(ref this.State, ref consequenceState); 7614applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7853LearnFromNonNullTest(argumentNoConversion, ref State); 8159LearnFromNullTest(argument, ref State); 8165LearnFromNonNullTest(argument, ref State); 8649NullableFlowState state = GetState(ref this.State, slot); 8931SetState(ref this.State, slot, NullableFlowState.NotNull); 9071SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9088SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9115SetState(ref this.State, targetFieldSlot, convertedType.State); 9426LearnFromNonNullTest(conversionOperand, ref State); 9524LearnFromNonNullTest(conversionOperand, ref State); 9917LearnFromNonNullTest(conversionOperand, ref State); 10242LearnFromNonNullTest(arg, ref State); 10989SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11167SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11493var state = GetState(ref this.State, slot); 11868SetState(ref this.State, slot, state); 12312SetState(ref this.State, slot, NullableFlowState.NotNull); 12518SetState(ref this.State, memberSlot, 12519node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 12629LearnFromNonNullTest(receiverOpt, ref this.State); 12833SetState(ref this.State, slot, NullableFlowState.NotNull); 12994Join(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); 579SetState(ref this.State, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null 682var tempState = GetState(ref this.State, tempSlot); 797Join(ref this.State, ref stateAndReachable.state.State); 939Join(ref endState, ref this.State);
145 references to State
Microsoft.CodeAnalysis.CSharp (145)
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(); 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)); 2623? (State, stateWhenNotNull) 2624: (stateWhenNotNull, State)); 2678? (State, stateWhenNotNull) 2679: (stateWhenNotNull, State)); 2734TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2768shortCircuitState = State.Clone(); 2826PendingBranches.Add(new PendingBranch(node, this.State, null)); 2881bodyState = this.State; 2903var breakState = this.State.Clone(); 2912PendingBranches.Add(new PendingBranch(node, this.State, null)); 2938SetConditionalState(stateWhenNotNull, State); 2979savedState = State.Clone(); 3079stateWhenNotNull = this.State.Clone(); 3095stateWhenNotNull = this.State.Clone(); 3100var savedState = this.State.Clone(); 3131stateWhenNotNull = State; 3149var savedState = this.State.Clone(); 3156savedState = this.State.Clone(); 3171var savedState = this.State.Clone(); 3176savedState = this.State.Clone(); 3258PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3266PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3311var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3369PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3380_labels[label] = this.State.Clone(); 3435PendingBranches.Add(new PendingBranch(node, this.State, null)); 3466PendingBranches.Add(new PendingBranch(node, this.State, null)); 3474PendingBranches.Add(new PendingBranch(node, this.State, null)); 3501var savedState = this.State; 3647TLocalState savedState = savedState = this.State.Clone(); 3753var savedState = this.State.Clone(); 3755leftState = this.State.Clone(); 3762var savedState = this.State.Clone(); 3764leftState = this.State.Clone(); 3855TLocalState initialState = this.State.Clone(); 3857TLocalState 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)
132_endOfRegionState = this.State.Clone();
FlowAnalysis\ControlFlowPass.cs (6)
108return new LocalState(false, this.State.Reported); 200return State.Alive; 262if (!this.State.Alive && 263!this.State.Reported && 269this.State.Reported = true; 376if (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)
390var savedState = this.State; 468if (Diagnostics != null && this.State.Reachable) 481if (!this.State.IsAssigned(thisSlot)) 492if (fieldSlot == -1 || !this.State.IsAssigned(fieldSlot)) 1159if (this.State.Reachable) 1162if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1163if (slot > 0 && !this.State.IsAssigned(slot)) 1273if (slot == -1 || !State.IsAssigned(slot)) 1371if (this.State.Reachable && !IsAssigned(expr, out int unassignedSlot)) 1476return this.State.IsAssigned(unassignedSlot); 1551SetSlotState(slot, assigned: written || !this.State.Reachable); 1564SetSlotState(slot, assigned: written || !this.State.Reachable); 1948if (!this.State.Reachable) 1973if (slot > 0 && !this.State.IsAssigned(slot)) 1984LocalState result = this.State.Clone(); 1998SetConditionalState(this.State, whenFail); 2438LocalState stateAfterLambda = this.State; 2440this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2597if (!this.State.Reachable) return; 2739if (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 (36)
506return $"{{{GetType().Name} {Dump(State)}{"}"}"; 617_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode, State); 624enforceMemberNotNull(syntaxOpt: null, this.State); 625EnforceParameterNotNullOnExit(syntaxOpt: null, this.State); 1864finalNullableState = GetVariableState(walker._variables, walker.State); 1932_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2631if (this.State.Reachable) 2969var parameterDefaultsNotAssignedState = State.Clone(); 3049PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3100PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3107EnforceNotNullIfNotNull(node.Syntax, this.State, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3421var oldState = this.State; 3446PendingBranches.Add(new PendingBranch(null, this.State, null)); 3453enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3455EnforceParameterNotNullOnExit(null, this.State); 3525var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3641var currentState = State; 5136var stateAfterLeft = this.State; 5139var stateWhenNotNull = this.State; 5152? (State, stateWhenNotNull) 5153: (stateWhenNotNull, State)); 5236? (State, stateWhenNotNull) 5237: (stateWhenNotNull, State)); 5832var leftState = this.State.Clone(); 6051var savedState = this.State.Clone(); 6177consequenceState = this.State; 6429=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 8072var newWhenTrue = State.Clone(); 8078SetConditionalState(newWhenTrue, whenFalse: State); 8905var savedState = this.State.Clone(); 10370var stateForLambda = this.State.Clone(); 10396initialState.HasValue ? initialState.Value : State.Clone(), 11020if (this.State.Reachable) 12182var rightState = State.Clone(); 12344SetConditionalState(stateWhenNotNull, State); 12614if (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); 669labelStateMap.Add(d.Label, (this.State, nodeBelievedReachable)); 717gotoNode(w.WhenTrue, this.State, nodeBelievedReachable); 927if (!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;