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