112 writes to State
Microsoft.CodeAnalysis.CSharp (112)
FlowAnalysis\AbstractFlowPass.cs (31)
134State = default(TLocalState); 144State = newState; 444this.State = initialState.HasValue ? initialState.Value : TopState(); 548this.State = UnreachableState(); 692Join(ref this.State, ref previousState); 704if (Join(ref oldState, ref this.State)) 735JoinPendingBranches(ref this.State, continueLabel); 1134Join(ref this.State, ref shortCircuitState); 1302this.State = savedState; 1322Join(ref State, ref localFunctionState.StateFromBottom); 1326Meet(ref State, ref localFunctionState.StateFromTop); 1671Join(ref this.State, ref trueState); 1690Join(ref endState, ref this.State); 1736Meet(ref endState, ref this.State); 1749Meet(ref stateToUpdate, ref this.State); 2396Meet(ref stateWhenNotNull, ref State); 2519Join(ref State, ref shortCircuitState); 2554Join(ref shortCircuitState, ref State); 2770Join(ref this.State, ref savedState); 2901Join(ref savedState, ref State); 2908State = savedState; 2909Join(ref State, ref stateWhenNotNull); 2928Join(ref this.State, ref savedState); 2934Join(ref this.State, ref savedState); 2950Join(ref this.State, ref savedState); 2954Join(ref this.State, ref savedState); 3088Join(ref this.State, ref afterConsequenceWhenTrue); 3150Join(ref this.State, ref state); 3423this.State = savedState; 3540Join(ref this.State, ref leftState); 3632Join(ref this.State, ref afterBlock);
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (4)
78this.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)
189State = new LocalState(BitVector.Empty); 208State = new LocalState(BitVector.Empty); 230State = new LocalState(BitVector.Empty); 386this.State = returnBranch.State; 389Join(ref savedState, ref this.State); 392this.State = savedState; 1117if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1637SetSlotAssigned(slot, ref this.State); 1678SetSlotUnassigned(slot, ref this.State); 2271this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2281Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2284this.State = pending.State; 2295Join(ref stateAfterLambda, ref this.State); // a no-op except in region analysis 2298this.State = stateAfterLambda;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
79Normalize(ref this.State);
FlowAnalysis\LocalDataFlowPass.cs (1)
142Normalize(ref this.State);
FlowAnalysis\NullableWalker.cs (44)
909SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 1063SetState(ref this.State, memberSlot, NullableFlowState.MaybeNull); 2270LearnFromNonNullTest(value, ref State); 2473SetStateAndTrackForFinally(ref this.State, targetSlot, newState); 2583GetState(ref this.State, valueMemberSlot) : 2587SetStateAndTrackForFinally(ref this.State, targetMemberSlot, value); 2651SetStateAndTrackForFinally(ref this.State, slot, GetDefaultState(symbol)); 2737Join(ref State, ref parameterDefaultsNotAssignedState); 2752SetState(ref this.State, slot, state); 3094this.State = state.CreateNestedMethodState(_variables); 3136this.State = oldState; 3251SetState(ref this.State, slot, GetDefaultState(ref this.State, slot)); 3614SetState(ref this.State, slot, resultState); 3831if (!initializer.Type.IsValueType && GetState(ref State, slot).MayBeNull()) 5107LearnFromNullTest(leftOperand, ref this.State); 5114Join(ref this.State, ref leftState); 5141LearnFromNullTest(leftOperand, ref this.State); 5339Join(ref savedState, ref State); 5365LearnFromNonNullTest(slot, ref State); 5371Join(ref this.State, ref savedState); 5392LearnFromNonNullTest(slot, ref State); 5431Join(ref this.State, ref consequenceState); 6398applyMemberPostConditions(receiverSlot, type, notNullMembers, ref State); 6600LearnFromNonNullTest(argumentNoConversion, ref State); 6906LearnFromNullTest(argument, ref State); 6912LearnFromNonNullTest(argument, ref State); 7312NullableFlowState state = GetState(ref this.State, slot); 7584SetState(ref this.State, slot, NullableFlowState.NotNull); 7718SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 7735SetState(ref this.State, targetFieldSlot, NullableFlowState.NotNull); 7762SetState(ref this.State, targetFieldSlot, convertedType.State); 8060LearnFromNonNullTest(conversionOperand, ref State); 8158LearnFromNonNullTest(conversionOperand, ref State); 8516LearnFromNonNullTest(conversionOperand, ref State); 8838LearnFromNonNullTest(arg, ref State); 9902var state = GetState(ref this.State, slot); 10234SetState(ref this.State, slot, state); 10574SetState(ref this.State, slot, NullableFlowState.NotNull); 10782SetState(ref this.State, memberSlot, 10783node.IsAddition ? GetState(ref this.State, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull); 10893LearnFromNonNullTest(receiverOpt, ref this.State); 11097SetState(ref this.State, slot, NullableFlowState.NotNull); 11258Join(ref State, ref other.State);
FlowAnalysis\NullableWalker_Patterns.cs (8)
150LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 163LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 170LearnFromNullTest(inputSlot, inputType, ref this.State, markDependentSlotsNotNull: false); 443SetState(ref State, outputSlot, NullableFlowState.NotNull); 537SetState(ref this.State, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null 640var tempState = GetState(ref this.State, tempSlot); 755Join(ref this.State, ref stateAndReachable.state.State); 897Join(ref endState, ref this.State);
143 references to State
Microsoft.CodeAnalysis.CSharp (143)
FlowAnalysis\AbstractFlowPass.cs (54)
151SetConditionalState(State, State.Clone()); 230: Dump(this.State); 630SetConditionalState(this.State, UnreachableState()); 635SetConditionalState(UnreachableState(), this.State); 695_loopHeadState[node] = this.State.Clone(); 931? (State, stateWhenNotNull) 932: (stateWhenNotNull, State)); 958SetConditionalState(UnreachableState(), this.State); 963SetConditionalState(this.State, UnreachableState()); 1127TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 1285savedState = this.State.Clone(); 1664trueState = this.State; 1678var initialState = this.State.Clone(); 1685var endState = this.State; 1878PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2154PendingBranches.Add(new PendingBranch(node, this.State, null)); 2401? (State, stateWhenNotNull) 2402: (stateWhenNotNull, State)); 2454? (State, stateWhenNotNull) 2455: (stateWhenNotNull, State)); 2510TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default; 2544shortCircuitState = State.Clone(); 2602PendingBranches.Add(new PendingBranch(node, this.State, null)); 2657bodyState = this.State; 2678var breakState = this.State.Clone(); 2688PendingBranches.Add(new PendingBranch(node, this.State, null)); 2714SetConditionalState(stateWhenNotNull, State); 2755savedState = State.Clone(); 2855stateWhenNotNull = this.State.Clone(); 2871stateWhenNotNull = this.State.Clone(); 2876var savedState = this.State.Clone(); 2907stateWhenNotNull = State; 2925var savedState = this.State.Clone(); 2932savedState = this.State.Clone(); 2947var savedState = this.State.Clone(); 2952savedState = this.State.Clone(); 3029PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3037PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3082var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State); 3140PendingBranches.Add(new PendingBranch(node, this.State, node.Label)); 3151_labels[label] = this.State.Clone(); 3206PendingBranches.Add(new PendingBranch(node, this.State, null)); 3237PendingBranches.Add(new PendingBranch(node, this.State, null)); 3245PendingBranches.Add(new PendingBranch(node, this.State, null)); 3272var savedState = this.State; 3418TLocalState savedState = savedState = this.State.Clone(); 3524var savedState = this.State.Clone(); 3526leftState = this.State.Clone(); 3533var savedState = this.State.Clone(); 3535leftState = this.State.Clone(); 3626TLocalState initialState = this.State.Clone(); 3628TLocalState afterBlock = this.State;
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (3)
77var savedState = this.State; 101PendingBranches.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; 378if (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)
383var savedState = this.State; 460if (Diagnostics != null && this.State.Reachable) 473if (!this.State.IsAssigned(thisSlot)) 482if (fieldSlot == -1 || !this.State.IsAssigned(fieldSlot)) 1114if (this.State.Reachable) 1117if (slot >= this.State.Assigned.Capacity) Normalize(ref this.State); 1118if (slot > 0 && !this.State.IsAssigned(slot)) 1229if (slot == -1 || !State.IsAssigned(slot)) 1309if (this.State.Reachable && !IsAssigned(expr, out int unassignedSlot)) 1408return this.State.IsAssigned(unassignedSlot); 1479SetSlotState(slot, assigned: written || !this.State.Reachable); 1492SetSlotState(slot, assigned: written || !this.State.Reachable); 1809if (!this.State.Reachable) 1834if (slot > 0 && !this.State.IsAssigned(slot)) 1845LocalState result = this.State.Clone(); 1859SetConditionalState(this.State, whenFail); 2269LocalState stateAfterLambda = this.State; 2271this.State = this.State.Reachable ? this.State.Clone() : ReachableBottomState(); 2428if (!this.State.Reachable) return; 2566if (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 (34)
458return $"{{{GetType().Name} {Dump(State)}{"}"}"; 564_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode, State); 571enforceMemberNotNull(syntaxOpt: null, this.State); 572EnforceParameterNotNullOnExit(syntaxOpt: null, this.State); 1712finalNullableState = GetVariableState(walker._variables, walker.State); 1780_snapshotBuilderOpt?.TakeIncrementalSnapshot(node, State); 2460if (this.State.Reachable) 2728var parameterDefaultsNotAssignedState = State.Clone(); 2808PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2859PendingBranches.Add(new PendingBranch(node, this.State, label: null)); 2865EnforceNotNullIfNotNull(node.Syntax, this.State, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null); 3092var oldState = this.State; 3109PendingBranches.Add(new PendingBranch(null, this.State, null)); 3114EnforceParameterNotNullOnExit(null, this.State); 3162var state = State.GetStateForVariables(localFunctionState.StartingState.Id); 3278var currentState = State; 4485var stateAfterLeft = this.State; 4488var stateWhenNotNull = this.State; 4501? (State, stateWhenNotNull) 4502: (stateWhenNotNull, State)); 4585? (State, stateWhenNotNull) 4586: (stateWhenNotNull, State)); 5105var leftState = this.State.Clone(); 5308var savedState = this.State.Clone(); 5429consequenceState = this.State; 5653=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.State.Reachable; 6497var savedState = (argument.Kind == BoundKind.Lambda) ? this.State.Clone() : default(Optional<LocalState>); 6819var newWhenTrue = State.Clone(); 6825SetConditionalState(newWhenTrue, whenFalse: State); 7558var savedState = this.State.Clone(); 8980initialState.HasValue ? initialState.Value : State.Clone(), 9536if (this.State.Reachable) 10608SetConditionalState(stateWhenNotNull, State); 10878if (receiverOpt != null && this.State.Reachable)
FlowAnalysis\NullableWalker_Patterns.cs (7)
37var currentState = State; 269PendingBranches.Add(new PendingBranch(label, this.State, label.Label)); 287if (!State.Reachable && label.WhenClause != null) 325: new PossiblyConditionalState(nullableWalker.State); 627labelStateMap.Add(d.Label, (this.State, nodeBelievedReachable)); 675gotoNode(w.WhenTrue, this.State, nodeBelievedReachable); 885if (!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;