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);
1803
Join(ref this.
State
, ref trueState);
1831
Join(ref endState, ref this.
State
);
1877
Meet(ref endState, ref this.
State
);
1890
Meet(ref stateToUpdate, ref this.
State
);
2590
Meet(ref stateWhenNotNull, ref
State
);
2715
Join(ref
State
, ref shortCircuitState);
2750
Join(ref shortCircuitState, ref
State
);
2966
Join(ref this.
State
, ref savedState);
3097
Join(ref savedState, ref
State
);
3104
State
= savedState;
3105
Join(ref
State
, ref stateWhenNotNull);
3124
Join(ref this.
State
, ref savedState);
3130
Join(ref this.
State
, ref savedState);
3146
Join(ref this.
State
, ref savedState);
3150
Join(ref this.
State
, ref savedState);
3289
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3351
Join(ref this.
State
, ref state);
3624
this.
State
= savedState;
3741
Join(ref this.
State
, ref leftState);
3833
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);
385
this.
State
= returnBranch.State;
388
Join(ref savedState, ref this.
State
);
391
this.
State
= savedState;
1161
if (slot >= this.State.Assigned.Capacity) Normalize(ref this.
State
);
1757
SetSlotAssigned(slot, ref this.
State
);
1798
SetSlotUnassigned(slot, ref this.
State
);
2435
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2445
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2448
this.
State
= pending.State;
2459
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2462
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)
842
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1169
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2400
LearnFromNonNullTest(value, ref
State
);
2603
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2713
GetState(ref this.
State
, valueMemberSlot) :
2717
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2795
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
2878
Join(ref
State
, ref parameterDefaultsNotAssignedState);
2893
SetState(ref this.
State
, slot, state);
3322
this.
State
= state.CreateNestedMethodState(_variables);
3385
this.
State
= oldState;
3513
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4079
SetState(ref this.
State
, slot, resultState);
4297
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5202
LearnFromNonNullTest(operand, ref
State
);
5619
LearnFromNullTest(leftOperand, ref this.
State
);
5631
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5641
Join(ref this.
State
, ref leftState);
5668
LearnFromNullTest(leftOperand, ref this.
State
);
5866
Join(ref savedState, ref
State
);
5892
LearnFromNonNullTest(slot, ref
State
);
5898
Join(ref this.
State
, ref savedState);
5919
LearnFromNonNullTest(slot, ref
State
);
5963
Join(ref this.
State
, ref consequenceState);
7227
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7466
LearnFromNonNullTest(argumentNoConversion, ref
State
);
7772
LearnFromNullTest(argument, ref
State
);
7778
LearnFromNonNullTest(argument, ref
State
);
8224
NullableFlowState state = GetState(ref this.
State
, slot);
8504
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
8644
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8661
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8688
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
8999
LearnFromNonNullTest(conversionOperand, ref
State
);
9097
LearnFromNonNullTest(conversionOperand, ref
State
);
9482
LearnFromNonNullTest(conversionOperand, ref
State
);
9807
LearnFromNonNullTest(arg, ref
State
);
10855
var state = GetState(ref this.
State
, slot);
11224
SetState(ref this.
State
, slot, state);
11564
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
11770
SetState(ref this.
State
, memberSlot,
11771
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
11881
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12085
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12246
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();
1779
trueState = this.
State
;
1819
var initialState = this.
State
.Clone();
1826
var endState = this.
State
;
2019
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2327
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2595
? (
State
, stateWhenNotNull)
2596
: (stateWhenNotNull,
State
));
2650
? (
State
, stateWhenNotNull)
2651
: (stateWhenNotNull,
State
));
2706
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2740
shortCircuitState =
State
.Clone();
2798
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2853
bodyState = this.
State
;
2875
var breakState = this.
State
.Clone();
2884
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2910
SetConditionalState(stateWhenNotNull,
State
);
2951
savedState =
State
.Clone();
3051
stateWhenNotNull = this.
State
.Clone();
3067
stateWhenNotNull = this.
State
.Clone();
3072
var savedState = this.
State
.Clone();
3103
stateWhenNotNull =
State
;
3121
var savedState = this.
State
.Clone();
3128
savedState = this.
State
.Clone();
3143
var savedState = this.
State
.Clone();
3148
savedState = this.
State
.Clone();
3230
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3238
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3283
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3341
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3352
_labels[label] = this.
State
.Clone();
3407
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3438
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3446
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3473
var savedState = this.
State
;
3619
TLocalState savedState = savedState = this.
State
.Clone();
3725
var savedState = this.
State
.Clone();
3727
leftState = this.
State
.Clone();
3734
var savedState = this.
State
.Clone();
3736
leftState = this.
State
.Clone();
3827
TLocalState initialState = this.
State
.Clone();
3829
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)
382
var savedState = this.
State
;
459
if (Diagnostics != null && this.
State
.Reachable)
472
if (!this.
State
.IsAssigned(thisSlot))
483
if (fieldSlot == -1 || !this.
State
.IsAssigned(fieldSlot))
1158
if (this.
State
.Reachable)
1161
if (slot >= this.
State
.Assigned.Capacity) Normalize(ref this.State);
1162
if (slot > 0 && !this.
State
.IsAssigned(slot))
1272
if (slot == -1 || !
State
.IsAssigned(slot))
1370
if (this.
State
.Reachable && !IsAssigned(expr, out int unassignedSlot))
1475
return this.
State
.IsAssigned(unassignedSlot);
1550
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1563
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1935
if (!this.
State
.Reachable)
1960
if (slot > 0 && !this.
State
.IsAssigned(slot))
1971
LocalState result = this.
State
.Clone();
1985
SetConditionalState(this.
State
, whenFail);
2433
LocalState stateAfterLambda = this.
State
;
2435
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2592
if (!this.
State
.Reachable) return;
2734
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)
492
return $"{{{GetType().Name} {Dump(
State
)}{"}"}";
598
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
605
enforceMemberNotNull(syntaxOpt: null, this.
State
);
606
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1823
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1891
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2590
if (this.
State
.Reachable)
2869
var parameterDefaultsNotAssignedState =
State
.Clone();
2949
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3000
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3006
EnforceNotNullIfNotNull(node.Syntax, this.
State
, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3320
var oldState = this.
State
;
3345
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3352
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3354
EnforceParameterNotNullOnExit(null, this.
State
);
3424
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3540
var currentState =
State
;
4978
var stateAfterLeft = this.
State
;
4981
var stateWhenNotNull = this.
State
;
4994
? (
State
, stateWhenNotNull)
4995
: (stateWhenNotNull,
State
));
5078
? (
State
, stateWhenNotNull)
5079
: (stateWhenNotNull,
State
));
5617
var leftState = this.
State
.Clone();
5835
var savedState = this.
State
.Clone();
5961
consequenceState = this.
State
;
6213
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
7685
var newWhenTrue =
State
.Clone();
7691
SetConditionalState(newWhenTrue, whenFalse:
State
);
8478
var savedState = this.
State
.Clone();
9923
var stateForLambda = this.
State
.Clone();
9949
initialState.HasValue ? initialState.Value :
State
.Clone(),
10492
if (this.
State
.Reachable)
11596
SetConditionalState(stateWhenNotNull,
State
);
11866
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;