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);
3284
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3346
Join(ref this.
State
, ref state);
3619
this.
State
= savedState;
3736
Join(ref this.
State
, ref leftState);
3828
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);
2398
LearnFromNonNullTest(value, ref
State
);
2601
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2711
GetState(ref this.
State
, valueMemberSlot) :
2715
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2793
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
2876
Join(ref
State
, ref parameterDefaultsNotAssignedState);
2891
SetState(ref this.
State
, slot, state);
3320
this.
State
= state.CreateNestedMethodState(_variables);
3383
this.
State
= oldState;
3511
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4075
SetState(ref this.
State
, slot, resultState);
4292
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5197
LearnFromNonNullTest(operand, ref
State
);
5614
LearnFromNullTest(leftOperand, ref this.
State
);
5626
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5636
Join(ref this.
State
, ref leftState);
5663
LearnFromNullTest(leftOperand, ref this.
State
);
5861
Join(ref savedState, ref
State
);
5887
LearnFromNonNullTest(slot, ref
State
);
5893
Join(ref this.
State
, ref savedState);
5914
LearnFromNonNullTest(slot, ref
State
);
5958
Join(ref this.
State
, ref consequenceState);
7216
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7455
LearnFromNonNullTest(argumentNoConversion, ref
State
);
7761
LearnFromNullTest(argument, ref
State
);
7767
LearnFromNonNullTest(argument, ref
State
);
8213
NullableFlowState state = GetState(ref this.
State
, slot);
8493
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
8633
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8650
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8677
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
8988
LearnFromNonNullTest(conversionOperand, ref
State
);
9086
LearnFromNonNullTest(conversionOperand, ref
State
);
9471
LearnFromNonNullTest(conversionOperand, ref
State
);
9796
LearnFromNonNullTest(arg, ref
State
);
10844
var state = GetState(ref this.
State
, slot);
11213
SetState(ref this.
State
, slot, state);
11553
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
11759
SetState(ref this.
State
, memberSlot,
11760
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
11870
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12074
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12235
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();
3225
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3233
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3278
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3336
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3347
_labels[label] = this.
State
.Clone();
3402
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3433
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3441
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3468
var savedState = this.
State
;
3614
TLocalState savedState = savedState = this.
State
.Clone();
3720
var savedState = this.
State
.Clone();
3722
leftState = this.
State
.Clone();
3729
var savedState = this.
State
.Clone();
3731
leftState = this.
State
.Clone();
3822
TLocalState initialState = this.
State
.Clone();
3824
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
);
1821
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1889
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2588
if (this.
State
.Reachable)
2867
var parameterDefaultsNotAssignedState =
State
.Clone();
2947
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2998
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3004
EnforceNotNullIfNotNull(node.Syntax, this.
State
, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3318
var oldState = this.
State
;
3343
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3350
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3352
EnforceParameterNotNullOnExit(null, this.
State
);
3422
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3538
var currentState =
State
;
4973
var stateAfterLeft = this.
State
;
4976
var stateWhenNotNull = this.
State
;
4989
? (
State
, stateWhenNotNull)
4990
: (stateWhenNotNull,
State
));
5073
? (
State
, stateWhenNotNull)
5074
: (stateWhenNotNull,
State
));
5612
var leftState = this.
State
.Clone();
5830
var savedState = this.
State
.Clone();
5956
consequenceState = this.
State
;
6208
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
7674
var newWhenTrue =
State
.Clone();
7680
SetConditionalState(newWhenTrue, whenFalse:
State
);
8467
var savedState = this.
State
.Clone();
9912
var stateForLambda = this.
State
.Clone();
9938
initialState.HasValue ? initialState.Value :
State
.Clone(),
10481
if (this.
State
.Reachable)
11585
SetConditionalState(stateWhenNotNull,
State
);
11855
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;