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; 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); 2617Meet(ref stateWhenNotNull, ref State); 2742Join(ref State, ref shortCircuitState); 2777Join(ref shortCircuitState, ref State); 2993Join(ref this.State, ref savedState); 3124Join(ref savedState, ref State); 3131State = savedState; 3132Join(ref State, ref stateWhenNotNull); 3151Join(ref this.State, ref savedState); 3157Join(ref this.State, ref savedState); 3173Join(ref this.State, ref savedState); 3177Join(ref this.State, ref savedState); 3316Join(ref this.State, ref afterConsequenceWhenTrue); 3378Join(ref this.State, ref state); 3651this.State = savedState; 3768Join(ref this.State, ref leftState); 3860Join(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); 2448this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2458Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2461this.State = pending.State; 2472Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2475this.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); 7613applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7852LearnFromNonNullTest(argumentNoConversion, ref State); 8158LearnFromNullTest(argument, ref State); 8164LearnFromNonNullTest(argument, ref State); 8648NullableFlowState state = GetState(ref this.State, slot); 8930SetState(ref this.State, slot, NullableFlowState.NotNull); 9070SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9087SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9114SetState(ref this.State, targetFieldSlot, convertedType.State); 9425LearnFromNonNullTest(conversionOperand, ref State); 9523LearnFromNonNullTest(conversionOperand, ref State); 9916LearnFromNonNullTest(conversionOperand, ref State); 10241LearnFromNonNullTest(arg, ref State); 10988SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11166SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11492var state = GetState(ref this.State, slot); 11867SetState(ref this.State, slot, state); 12311SetState(ref this.State, slot, NullableFlowState.NotNull); 12517SetState(ref this.State, memberSlot, 12518node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 12628LearnFromNonNullTest(receiverOpt, ref this.State); 12832SetState(ref this.State, slot, NullableFlowState.NotNull); 12993Join(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(); 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)); 2622? (State, stateWhenNotNull) 2623: (stateWhenNotNull, State)); 2677? (State, stateWhenNotNull) 2678: (stateWhenNotNull, State)); 2733TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2767shortCircuitState = State.Clone(); 2825PendingBranches.Add(new PendingBranch(node, this.State, null)); 2880bodyState = this.State; 2902var breakState = this.State.Clone(); 2911PendingBranches.Add(new PendingBranch(node, this.State, null)); 2937SetConditionalState(stateWhenNotNull, State); 2978savedState = State.Clone(); 3078stateWhenNotNull = this.State.Clone(); 3094stateWhenNotNull = this.State.Clone(); 3099var savedState = this.State.Clone(); 3130stateWhenNotNull = State; 3148var savedState = this.State.Clone(); 3155savedState = this.State.Clone(); 3170var savedState = this.State.Clone(); 3175savedState = this.State.Clone(); 3257PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3265PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3310var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3368PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3379_labels[label] = this.State.Clone(); 3434PendingBranches.Add(new PendingBranch(node, this.State, null)); 3465PendingBranches.Add(new PendingBranch(node, this.State, null)); 3473PendingBranches.Add(new PendingBranch(node, this.State, null)); 3500var savedState = this.State; 3646TLocalState savedState = savedState = this.State.Clone(); 3752var savedState = this.State.Clone(); 3754leftState = this.State.Clone(); 3761var savedState = this.State.Clone(); 3763leftState = this.State.Clone(); 3854TLocalState initialState = this.State.Clone(); 3856TLocalState 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); 2446LocalState stateAfterLambda = this.State; 2448this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2605if (!this.State.Reachable) return; 2747if (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; 8071var newWhenTrue = State.Clone(); 8077SetConditionalState(newWhenTrue, whenFalse: State); 8904var savedState = this.State.Clone(); 10369var stateForLambda = this.State.Clone(); 10395initialState.HasValue ? initialState.Value : State.Clone(), 11019if (this.State.Reachable) 12181var rightState = State.Clone(); 12343SetConditionalState(stateWhenNotNull, State); 12613if (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;