114 writes to State
Microsoft.CodeAnalysis.CSharp (114)
FlowAnalysis\AbstractFlowPass.cs (31)
134
State
= default(TLocalState);
144
State
= newState;
443
this.
State
= initialState.HasValue ? initialState.Value : TopState();
547
this.
State
= UnreachableState();
699
Join(ref this.
State
, ref previousState);
711
if (Join(ref oldState, ref this.
State
))
742
JoinPendingBranches(ref this.
State
, continueLabel);
1190
Join(ref this.
State
, ref shortCircuitState);
1376
this.
State
= savedState;
1409
Join(ref
State
, ref localFunctionState.StateFromBottom);
1413
Meet(ref
State
, ref localFunctionState.StateFromTop);
1810
Join(ref this.
State
, ref trueState);
1838
Join(ref endState, ref this.
State
);
1884
Meet(ref endState, ref this.
State
);
1897
Meet(ref stateToUpdate, ref this.
State
);
2597
Meet(ref stateWhenNotNull, ref
State
);
2722
Join(ref
State
, ref shortCircuitState);
2757
Join(ref shortCircuitState, ref
State
);
2973
Join(ref this.
State
, ref savedState);
3104
Join(ref savedState, ref
State
);
3111
State
= savedState;
3112
Join(ref
State
, ref stateWhenNotNull);
3131
Join(ref this.
State
, ref savedState);
3137
Join(ref this.
State
, ref savedState);
3153
Join(ref this.
State
, ref savedState);
3157
Join(ref this.
State
, ref savedState);
3296
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3358
Join(ref this.
State
, ref state);
3631
this.
State
= savedState;
3748
Join(ref this.
State
, ref leftState);
3840
Join(ref this.
State
, ref afterBlock);
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (4)
83
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)
188
State
= new LocalState(BitVector.Empty);
207
State
= new LocalState(BitVector.Empty);
229
State
= new LocalState(BitVector.Empty);
392
this.
State
= returnBranch.State;
396
Join(ref savedState, ref this.
State
);
399
this.
State
= savedState;
1176
if (slot >= this.State.Assigned.Capacity) Normalize(ref this.
State
);
1772
SetSlotAssigned(slot, ref this.
State
);
1813
SetSlotUnassigned(slot, ref this.
State
);
2462
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2472
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2475
this.
State
= pending.State;
2486
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2489
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 (46)
851
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1178
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2420
LearnFromNonNullTest(value, ref
State
);
2623
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2736
GetState(ref this.
State
, valueMemberSlot) :
2740
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2834
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
2957
Join(ref
State
, ref parameterDefaultsNotAssignedState);
2972
SetState(ref this.
State
, slot, state);
3401
this.
State
= state.CreateNestedMethodState(_variables);
3464
this.
State
= oldState;
3592
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4158
SetState(ref this.
State
, slot, resultState);
4376
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5283
LearnFromNonNullTest(operand, ref
State
);
5700
LearnFromNullTest(leftOperand, ref this.
State
);
5712
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5722
Join(ref this.
State
, ref leftState);
5749
LearnFromNullTest(leftOperand, ref this.
State
);
5947
Join(ref savedState, ref
State
);
5973
LearnFromNonNullTest(slot, ref
State
);
5979
Join(ref this.
State
, ref savedState);
6000
LearnFromNonNullTest(slot, ref
State
);
6044
Join(ref this.
State
, ref consequenceState);
7316
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7555
LearnFromNonNullTest(argumentNoConversion, ref
State
);
7861
LearnFromNullTest(argument, ref
State
);
7867
LearnFromNonNullTest(argument, ref
State
);
8313
NullableFlowState state = GetState(ref this.
State
, slot);
8595
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
8735
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8752
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8779
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9092
LearnFromNonNullTest(conversionOperand, ref
State
);
9190
LearnFromNonNullTest(conversionOperand, ref
State
);
9575
LearnFromNonNullTest(conversionOperand, ref
State
);
9900
LearnFromNonNullTest(arg, ref
State
);
10964
var state = GetState(ref this.
State
, slot);
11333
SetState(ref this.
State
, slot, state);
11673
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
11879
SetState(ref this.
State
, memberSlot,
11880
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
11990
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12194
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12355
Join(ref
State
, ref other.State);
FlowAnalysis\NullableWalker_Patterns.cs (8)
172
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
185
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
192
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
481
SetState(ref
State
, outputSlot, NullableFlowState.NotNull);
577
SetState(ref this.
State
, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null
680
var tempState = GetState(ref this.
State
, tempSlot);
795
Join(ref this.
State
, ref stateAndReachable.state.State);
937
Join(ref endState, ref this.
State
);
144 references to State
Microsoft.CodeAnalysis.CSharp (144)
FlowAnalysis\AbstractFlowPass.cs (54)
151
SetConditionalState(
State
,
State
.Clone());
230
: Dump(this.
State
);
637
SetConditionalState(this.
State
, UnreachableState());
642
SetConditionalState(UnreachableState(), this.
State
);
702
_loopHeadState[node] = this.
State
.Clone();
938
? (
State
, stateWhenNotNull)
939
: (stateWhenNotNull,
State
));
965
SetConditionalState(UnreachableState(), this.
State
);
970
SetConditionalState(this.
State
, UnreachableState());
1183
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
1341
savedState = this.
State
.Clone();
1786
trueState = this.
State
;
1826
var initialState = this.
State
.Clone();
1833
var endState = this.
State
;
2026
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2334
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2602
? (
State
, stateWhenNotNull)
2603
: (stateWhenNotNull,
State
));
2657
? (
State
, stateWhenNotNull)
2658
: (stateWhenNotNull,
State
));
2713
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2747
shortCircuitState =
State
.Clone();
2805
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2860
bodyState = this.
State
;
2882
var breakState = this.
State
.Clone();
2891
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2917
SetConditionalState(stateWhenNotNull,
State
);
2958
savedState =
State
.Clone();
3058
stateWhenNotNull = this.
State
.Clone();
3074
stateWhenNotNull = this.
State
.Clone();
3079
var savedState = this.
State
.Clone();
3110
stateWhenNotNull =
State
;
3128
var savedState = this.
State
.Clone();
3135
savedState = this.
State
.Clone();
3150
var savedState = this.
State
.Clone();
3155
savedState = this.
State
.Clone();
3237
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3245
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3290
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3348
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3359
_labels[label] = this.
State
.Clone();
3414
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3445
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3453
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3480
var savedState = this.
State
;
3626
TLocalState savedState = savedState = this.
State
.Clone();
3732
var savedState = this.
State
.Clone();
3734
leftState = this.
State
.Clone();
3741
var savedState = this.
State
.Clone();
3743
leftState = this.
State
.Clone();
3834
TLocalState initialState = this.
State
.Clone();
3836
TLocalState afterBlock = this.
State
;
FlowAnalysis\AbstractFlowPass_LocalFunctions.cs (3)
82
var savedState = this.
State
;
106
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;
377
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)
389
var savedState = this.
State
;
482
if (Diagnostics != null && this.
State
.Reachable)
495
if (!this.
State
.IsAssigned(thisSlot))
506
if (fieldSlot == -1 || !this.
State
.IsAssigned(fieldSlot))
1173
if (this.
State
.Reachable)
1176
if (slot >= this.
State
.Assigned.Capacity) Normalize(ref this.State);
1177
if (slot > 0 && !this.
State
.IsAssigned(slot))
1287
if (slot == -1 || !
State
.IsAssigned(slot))
1385
if (this.
State
.Reachable && !IsAssigned(expr, out int unassignedSlot))
1490
return this.
State
.IsAssigned(unassignedSlot);
1565
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1578
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1962
if (!this.
State
.Reachable)
1987
if (slot > 0 && !this.
State
.IsAssigned(slot))
1998
LocalState result = this.
State
.Clone();
2012
SetConditionalState(this.
State
, whenFail);
2460
LocalState stateAfterLambda = this.
State
;
2462
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2619
if (!this.
State
.Reachable) return;
2761
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 (35)
500
return $"{{{GetType().Name} {Dump(
State
)}{"}"}";
607
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
614
enforceMemberNotNull(syntaxOpt: null, this.
State
);
615
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1843
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1911
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2610
if (this.
State
.Reachable)
2948
var parameterDefaultsNotAssignedState =
State
.Clone();
3028
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3079
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3085
EnforceNotNullIfNotNull(node.Syntax, this.
State
, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3399
var oldState = this.
State
;
3424
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3431
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3433
EnforceParameterNotNullOnExit(null, this.
State
);
3503
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3619
var currentState =
State
;
5059
var stateAfterLeft = this.
State
;
5062
var stateWhenNotNull = this.
State
;
5075
? (
State
, stateWhenNotNull)
5076
: (stateWhenNotNull,
State
));
5159
? (
State
, stateWhenNotNull)
5160
: (stateWhenNotNull,
State
));
5698
var leftState = this.
State
.Clone();
5916
var savedState = this.
State
.Clone();
6042
consequenceState = this.
State
;
6294
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
7774
var newWhenTrue =
State
.Clone();
7780
SetConditionalState(newWhenTrue, whenFalse:
State
);
8569
var savedState = this.
State
.Clone();
10017
var stateForLambda = this.
State
.Clone();
10043
initialState.HasValue ? initialState.Value :
State
.Clone(),
10601
if (this.
State
.Reachable)
11705
SetConditionalState(stateWhenNotNull,
State
);
11975
if (receiverOpt != null && this.
State
.Reachable)
FlowAnalysis\NullableWalker_Patterns.cs (7)
37
var currentState =
State
;
307
PendingBranches.Add(new PendingBranch(label, this.
State
, label.Label));
325
if (!
State
.Reachable && label.WhenClause != null)
363
: new PossiblyConditionalState(nullableWalker.
State
);
667
labelStateMap.Add(d.Label, (this.
State
, nodeBelievedReachable));
715
gotoNode(w.WhenTrue, this.
State
, nodeBelievedReachable);
925
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;