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
);
2588
Meet(ref stateWhenNotNull, ref
State
);
2711
Join(ref
State
, ref shortCircuitState);
2746
Join(ref shortCircuitState, ref
State
);
2962
Join(ref this.
State
, ref savedState);
3093
Join(ref savedState, ref
State
);
3100
State
= savedState;
3101
Join(ref
State
, ref stateWhenNotNull);
3120
Join(ref this.
State
, ref savedState);
3126
Join(ref this.
State
, ref savedState);
3142
Join(ref this.
State
, ref savedState);
3146
Join(ref this.
State
, ref savedState);
3280
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3342
Join(ref this.
State
, ref state);
3615
this.
State
= savedState;
3732
Join(ref this.
State
, ref leftState);
3824
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)
841
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1108
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2337
LearnFromNonNullTest(value, ref
State
);
2540
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2650
GetState(ref this.
State
, valueMemberSlot) :
2654
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2732
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
2815
Join(ref
State
, ref parameterDefaultsNotAssignedState);
2830
SetState(ref this.
State
, slot, state);
3259
this.
State
= state.CreateNestedMethodState(_variables);
3322
this.
State
= oldState;
3450
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4014
SetState(ref this.
State
, slot, resultState);
4231
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5136
LearnFromNonNullTest(operand, ref
State
);
5553
LearnFromNullTest(leftOperand, ref this.
State
);
5565
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5575
Join(ref this.
State
, ref leftState);
5602
LearnFromNullTest(leftOperand, ref this.
State
);
5800
Join(ref savedState, ref
State
);
5826
LearnFromNonNullTest(slot, ref
State
);
5832
Join(ref this.
State
, ref savedState);
5853
LearnFromNonNullTest(slot, ref
State
);
5897
Join(ref this.
State
, ref consequenceState);
7155
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7394
LearnFromNonNullTest(argumentNoConversion, ref
State
);
7700
LearnFromNullTest(argument, ref
State
);
7706
LearnFromNonNullTest(argument, ref
State
);
8152
NullableFlowState state = GetState(ref this.
State
, slot);
8432
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
8572
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8589
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8616
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
8927
LearnFromNonNullTest(conversionOperand, ref
State
);
9025
LearnFromNonNullTest(conversionOperand, ref
State
);
9410
LearnFromNonNullTest(conversionOperand, ref
State
);
9735
LearnFromNonNullTest(arg, ref
State
);
10783
var state = GetState(ref this.
State
, slot);
11152
SetState(ref this.
State
, slot, state);
11492
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
11698
SetState(ref this.
State
, memberSlot,
11699
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
11809
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12013
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12174
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));
2593
? (
State
, stateWhenNotNull)
2594
: (stateWhenNotNull,
State
));
2646
? (
State
, stateWhenNotNull)
2647
: (stateWhenNotNull,
State
));
2702
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2736
shortCircuitState =
State
.Clone();
2794
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2849
bodyState = this.
State
;
2871
var breakState = this.
State
.Clone();
2880
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2906
SetConditionalState(stateWhenNotNull,
State
);
2947
savedState =
State
.Clone();
3047
stateWhenNotNull = this.
State
.Clone();
3063
stateWhenNotNull = this.
State
.Clone();
3068
var savedState = this.
State
.Clone();
3099
stateWhenNotNull =
State
;
3117
var savedState = this.
State
.Clone();
3124
savedState = this.
State
.Clone();
3139
var savedState = this.
State
.Clone();
3144
savedState = this.
State
.Clone();
3221
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3229
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3274
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3332
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3343
_labels[label] = this.
State
.Clone();
3398
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3429
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3437
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3464
var savedState = this.
State
;
3610
TLocalState savedState = savedState = this.
State
.Clone();
3716
var savedState = this.
State
.Clone();
3718
leftState = this.
State
.Clone();
3725
var savedState = this.
State
.Clone();
3727
leftState = this.
State
.Clone();
3818
TLocalState initialState = this.
State
.Clone();
3820
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)
491
return $"{{{GetType().Name} {Dump(
State
)}{"}"}";
597
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
604
enforceMemberNotNull(syntaxOpt: null, this.
State
);
605
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1760
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1828
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2527
if (this.
State
.Reachable)
2806
var parameterDefaultsNotAssignedState =
State
.Clone();
2886
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2937
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2943
EnforceNotNullIfNotNull(node.Syntax, this.
State
, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3257
var oldState = this.
State
;
3282
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3289
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3291
EnforceParameterNotNullOnExit(null, this.
State
);
3361
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3477
var currentState =
State
;
4912
var stateAfterLeft = this.
State
;
4915
var stateWhenNotNull = this.
State
;
4928
? (
State
, stateWhenNotNull)
4929
: (stateWhenNotNull,
State
));
5012
? (
State
, stateWhenNotNull)
5013
: (stateWhenNotNull,
State
));
5551
var leftState = this.
State
.Clone();
5769
var savedState = this.
State
.Clone();
5895
consequenceState = this.
State
;
6147
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
7613
var newWhenTrue =
State
.Clone();
7619
SetConditionalState(newWhenTrue, whenFalse:
State
);
8406
var savedState = this.
State
.Clone();
9851
var stateForLambda = this.
State
.Clone();
9877
initialState.HasValue ? initialState.Value :
State
.Clone(),
10420
if (this.
State
.Reachable)
11524
SetConditionalState(stateWhenNotNull,
State
);
11794
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;