125 writes to State
Microsoft.CodeAnalysis.CSharp (125)
FlowAnalysis\AbstractFlowPass.cs (31)
133State = default(TLocalState); 143State = 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; 1410Join(ref State, ref localFunctionState.StateFromBottom); 1414Meet(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); 2619Meet(ref stateWhenNotNull, ref State); 2744Join(ref State, ref shortCircuitState); 2779Join(ref shortCircuitState, ref State); 2995Join(ref this.State, ref savedState); 3126Join(ref savedState, ref State); 3133State = savedState; 3134Join(ref State, ref stateWhenNotNull); 3153Join(ref this.State, ref savedState); 3159Join(ref this.State, ref savedState); 3175Join(ref this.State, ref savedState); 3179Join(ref this.State, ref savedState); 3318Join(ref this.State, ref afterConsequenceWhenTrue); 3380Join(ref this.State, ref state); 3653this.State = savedState; 3780Join(ref this.State, ref leftState); 3872Join(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; 1114if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1710SetSlotAssigned(slot, ref this.State); 1751SetSlotUnassigned(slot, ref this.State); 2392this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2402Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2405this.State = pending.State; 2416Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2419this.State = stateAfterLambda;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
79Normalize(ref this.State);
FlowAnalysis\LocalDataFlowPass.cs (1)
142Normalize(ref this.State);
FlowAnalysis\NullableWalker.cs (56)
897SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 1224SetState(ref this.State, memberSlot, NullableFlowState.MaybeNull); 2496LearnFromNonNullTest(value, ref State); 2699SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2813GetState(ref this.State, valueMemberSlot) : 2817SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2911SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 3034Join(ref State, ref parameterDefaultsNotAssignedState); 3049SetState(ref this.State, slot, state); 3478this.State = state.CreateNestedMethodState(_variables); 3541this.State = oldState; 3694SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 4449SetState(ref this.State, slot, resultState); 4502operandState = GetState(ref this.State, operandSlot); 4513SetState(ref this.State, iUnionValuePropertySlot, operandState); 4773if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5802LearnFromNonNullTest(operand, ref State); 6155LearnFromNullTest(leftOperand, ref this.State); 6167SetState(ref this.State, leftSlot, NullableFlowState.NotNull); 6177Join(ref this.State, ref leftState); 6204LearnFromNullTest(leftOperand, ref this.State); 6405Join(ref savedState, ref State); 6431LearnFromNonNullTest(slot, ref State); 6437Join(ref this.State, ref savedState); 6458LearnFromNonNullTest(slot, ref State); 6502Join(ref this.State, ref consequenceState); 7986applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 8243LearnFromNonNullTest(argumentNoConversion, ref State); 8569LearnFromNullTest(argument, ref State); 8575LearnFromNonNullTest(argument, ref State); 9116NullableFlowState state = GetState(ref this.State, slot); 9398SetState(ref this.State, slot, NullableFlowState.NotNull); 9539SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9556SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 9583SetState(ref this.State, targetFieldSlot, convertedType.State); 9600valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.State, valueFieldSlot)); 9615SetState(ref this.State, conversionOperandSlot, valueFieldType.State); 9635SetState(ref this.State, targetFieldSlot, convertedType.State); 9640SetState(ref this.State, valueFieldSlot, GetState(ref this.State, conversionOperandSlot)); 9974LearnFromNonNullTest(conversionOperand, ref State); 10087LearnFromNonNullTest(conversionOperand, ref State); 10501LearnFromNonNullTest(conversionOperand, ref State); 10664LearnFromNonNullTest(conversionOperand, ref State); 10996LearnFromNonNullTest(arg, ref State); 11745SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 11938SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref State, extensionReceiverSlot))); 12281var state = GetState(ref this.State, slot); 12654SetState(ref this.State, slot, state); 13103SetState(ref this.State, slot, NullableFlowState.NotNull); 13309SetState(ref this.State, memberSlot, 13310node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 13420LearnFromNonNullTest(receiverOpt, ref this.State); 13624SetState(ref this.State, slot, NullableFlowState.NotNull); 13839Join(ref State, ref other.State);
FlowAnalysis\NullableWalker_Patterns.cs (9)
175LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 188LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 195LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 464SetState(ref State, outputSlot, NullableFlowState.NotNull); 516SetState(ref this.State, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null 524var inputState = GetState(ref this.State, inputSlot); 629var tempState = GetState(ref this.State, tempSlot); 906Join(ref this.State, ref stateAndReachable.state.State); 1039Join(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); 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(); 1785trueState = this.State; 1825var initialState = this.State.Clone(); 1832var endState = this.State; 2026PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2335PendingBranches.Add(new PendingBranch(node, this.State, null)); 2624? (State, stateWhenNotNull) 2625: (stateWhenNotNull, State)); 2679? (State, stateWhenNotNull) 2680: (stateWhenNotNull, State)); 2735TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2769shortCircuitState = State.Clone(); 2827PendingBranches.Add(new PendingBranch(node, this.State, null)); 2882bodyState = this.State; 2904var breakState = this.State.Clone(); 2913PendingBranches.Add(new PendingBranch(node, this.State, null)); 2939SetConditionalState(stateWhenNotNull, State); 2980savedState = State.Clone(); 3080stateWhenNotNull = this.State.Clone(); 3096stateWhenNotNull = this.State.Clone(); 3101var savedState = this.State.Clone(); 3132stateWhenNotNull = State; 3150var savedState = this.State.Clone(); 3157savedState = this.State.Clone(); 3172var savedState = this.State.Clone(); 3177savedState = this.State.Clone(); 3259PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3267PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3312var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3370PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3381_labels[label] = this.State.Clone(); 3436PendingBranches.Add(new PendingBranch(node, this.State, null)); 3467PendingBranches.Add(new PendingBranch(node, this.State, null)); 3475PendingBranches.Add(new PendingBranch(node, this.State, null)); 3502var savedState = this.State; 3648TLocalState savedState = savedState = this.State.Clone(); 3764var savedState = this.State.Clone(); 3766leftState = this.State.Clone(); 3773var savedState = this.State.Clone(); 3775leftState = this.State.Clone(); 3866TLocalState initialState = this.State.Clone(); 3868TLocalState 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; 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)
390var savedState = this.State; 419if (Diagnostics != null && this.State.Reachable) 432if (!this.State.IsAssigned(thisSlot)) 443if (fieldSlot == -1 || !this.State.IsAssigned(fieldSlot)) 1111if (this.State.Reachable) 1114if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1115if (slot > 0 && !this.State.IsAssigned(slot)) 1225if (slot == -1 || !State.IsAssigned(slot)) 1323if (this.State.Reachable && !IsAssigned(expr, out int unassignedSlot)) 1428return this.State.IsAssigned(unassignedSlot); 1503SetSlotState(slot, assigned: written || !this.State.Reachable); 1516SetSlotState(slot, assigned: written || !this.State.Reachable); 1900if (!this.State.Reachable) 1925if (slot > 0 && !this.State.IsAssigned(slot)) 1936LocalState result = this.State.Clone(); 1950SetConditionalState(this.State, whenFail); 2390LocalState stateAfterLambda = this.State; 2392this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2549if (!this.State.Reachable) return; 2695if (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)
542return $"{{{GetType().Name} {Dump(State)}{"}"}"; 654_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode, State); 661enforceMemberNotNull(syntaxOpt: null, this.State); 662EnforceParameterNotNullOnExit(syntaxOpt: null, this.State); 1901finalNullableState = GetVariableState(walker._variables, walker.State); 1969_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2686if (this.State.Reachable) 3025var parameterDefaultsNotAssignedState = State.Clone(); 3105PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3156PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 3163EnforceNotNullIfNotNull(node.Syntax, this.State, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3476var oldState = this.State; 3501PendingBranches.Add(new PendingBranch(null, this.State, null)); 3508enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.State); 3510EnforceParameterNotNullOnExit(null, this.State); 3580var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3721var currentState = State; 5457var stateAfterLeft = this.State; 5460var stateWhenNotNull = this.State; 5473? (State, stateWhenNotNull) 5474: (stateWhenNotNull, State)); 5557? (State, stateWhenNotNull) 5558: (stateWhenNotNull, State)); 6153var leftState = this.State.Clone(); 6374var savedState = this.State.Clone(); 6500consequenceState = this.State; 6752=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 8463var newWhenTrue = State.Clone(); 8469SetConditionalState(newWhenTrue, whenFalse: State); 9372var savedState = this.State.Clone(); 11124var stateForLambda = this.State.Clone(); 11150initialState.HasValue ? initialState.Value : State.Clone(), 11776if (this.State.Reachable) 12975var rightState = State.Clone(); 13135SetConditionalState(stateWhenNotNull, State); 13405if (receiverOpt != null && this.State.Reachable)
FlowAnalysis\NullableWalker_Patterns.cs (6)
38var currentState = State; 309PendingBranches.Add(new PendingBranch(label, this.State, label.Label)); 365: new PossiblyConditionalState(nullableWalker.State); 616labelStateMap.Add(d.Label, (this.State, nodeBelievedReachable)); 664gotoNode(w.WhenTrue, this.State, nodeBelievedReachable); 1027if (!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;