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)
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)); 4228SetState(ref this.State, slot, resultState); 4446if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5474LearnFromNonNullTest(operand, ref State); 5827LearnFromNullTest(leftOperand, ref this.State); 5839SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 5849Join(ref this.State, ref leftState); 5876LearnFromNullTest(leftOperand, ref this.State); 6075Join(ref savedState, ref State); 6101LearnFromNonNullTest(slot, ref State); 6107Join(ref this.State, ref savedState); 6128LearnFromNonNullTest(slot, ref State); 6172Join(ref this.State, ref consequenceState); 7611applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 7850LearnFromNonNullTest(argumentNoConversion, ref State); 8156LearnFromNullTest(argument, ref State); 8162LearnFromNonNullTest(argument, ref State); 8646NullableFlowState state = GetState(ref this.State, slot); 8927SetState(ref this.State, slot, NullableFlowState.NotNull); 9067SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9084SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9111SetState(ref this.State, targetFieldSlot, convertedType.State); 9422LearnFromNonNullTest(conversionOperand, ref State); 9520LearnFromNonNullTest(conversionOperand, ref State); 9905LearnFromNonNullTest(conversionOperand, ref State); 10230LearnFromNonNullTest(arg, ref State); 10977SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11155SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11475var state = GetState(ref this.State, slot); 11844SetState(ref this.State, slot, state); 12288SetState(ref this.State, slot, NullableFlowState.NotNull); 12494SetState(ref this.State, memberSlot, 12495node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 12605LearnFromNonNullTest(receiverOpt, ref this.State); 12809SetState(ref this.State, slot, NullableFlowState.NotNull); 12970Join(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);
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)
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; 5129var stateAfterLeft = this.State; 5132var stateWhenNotNull = this.State; 5145? (State, stateWhenNotNull) 5146: (stateWhenNotNull, State)); 5229? (State, stateWhenNotNull) 5230: (stateWhenNotNull, State)); 5825var leftState = this.State.Clone(); 6044var savedState = this.State.Clone(); 6170consequenceState = this.State; 6422=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 8069var newWhenTrue = State.Clone(); 8075SetConditionalState(newWhenTrue, whenFalse: State); 8901var savedState = this.State.Clone(); 10358var stateForLambda = this.State.Clone(); 10384initialState.HasValue ? initialState.Value : State.Clone(), 11008if (this.State.Reachable) 12158var rightState = State.Clone(); 12320SetConditionalState(stateWhenNotNull, State); 12590if (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;