114 writes to State
Microsoft.CodeAnalysis.CSharp (114)
FlowAnalysis\AbstractFlowPass.cs (31)
133
State
= default(TLocalState);
143
State
= newState;
442
this.
State
= initialState.HasValue ? initialState.Value : TopState();
546
this.
State
= UnreachableState();
698
Join(ref this.
State
, ref previousState);
710
if (Join(ref oldState, ref this.
State
))
741
JoinPendingBranches(ref this.
State
, continueLabel);
1189
Join(ref this.
State
, ref shortCircuitState);
1375
this.
State
= savedState;
1408
Join(ref
State
, ref localFunctionState.StateFromBottom);
1412
Meet(ref
State
, ref localFunctionState.StateFromTop);
1809
Join(ref this.
State
, ref trueState);
1837
Join(ref endState, ref this.
State
);
1883
Meet(ref endState, ref this.
State
);
1896
Meet(ref stateToUpdate, ref this.
State
);
2596
Meet(ref stateWhenNotNull, ref
State
);
2721
Join(ref
State
, ref shortCircuitState);
2756
Join(ref shortCircuitState, ref
State
);
2972
Join(ref this.
State
, ref savedState);
3103
Join(ref savedState, ref
State
);
3110
State
= savedState;
3111
Join(ref
State
, ref stateWhenNotNull);
3130
Join(ref this.
State
, ref savedState);
3136
Join(ref this.
State
, ref savedState);
3152
Join(ref this.
State
, ref savedState);
3156
Join(ref this.
State
, ref savedState);
3295
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3357
Join(ref this.
State
, ref state);
3630
this.
State
= savedState;
3747
Join(ref this.
State
, ref leftState);
3839
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;
1161
if (slot >= this.State.Assigned.Capacity) Normalize(ref this.
State
);
1757
SetSlotAssigned(slot, ref this.
State
);
1798
SetSlotUnassigned(slot, ref this.
State
);
2447
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2457
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2460
this.
State
= pending.State;
2471
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2474
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)
855
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1182
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2435
LearnFromNonNullTest(value, ref
State
);
2638
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2751
GetState(ref this.
State
, valueMemberSlot) :
2755
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2849
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
2972
Join(ref
State
, ref parameterDefaultsNotAssignedState);
2987
SetState(ref this.
State
, slot, state);
3417
this.
State
= state.CreateNestedMethodState(_variables);
3480
this.
State
= oldState;
3608
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4174
SetState(ref this.
State
, slot, resultState);
4392
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5358
LearnFromNonNullTest(operand, ref
State
);
5711
LearnFromNullTest(leftOperand, ref this.
State
);
5723
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5733
Join(ref this.
State
, ref leftState);
5760
LearnFromNullTest(leftOperand, ref this.
State
);
5959
Join(ref savedState, ref
State
);
5985
LearnFromNonNullTest(slot, ref
State
);
5991
Join(ref this.
State
, ref savedState);
6012
LearnFromNonNullTest(slot, ref
State
);
6056
Join(ref this.
State
, ref consequenceState);
7443
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7682
LearnFromNonNullTest(argumentNoConversion, ref
State
);
7988
LearnFromNullTest(argument, ref
State
);
7994
LearnFromNonNullTest(argument, ref
State
);
8447
NullableFlowState state = GetState(ref this.
State
, slot);
8728
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
8868
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8885
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
8912
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9223
LearnFromNonNullTest(conversionOperand, ref
State
);
9321
LearnFromNonNullTest(conversionOperand, ref
State
);
9706
LearnFromNonNullTest(conversionOperand, ref
State
);
10031
LearnFromNonNullTest(arg, ref
State
);
11142
var state = GetState(ref this.
State
, slot);
11511
SetState(ref this.
State
, slot, state);
11851
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12057
SetState(ref this.
State
, memberSlot,
12058
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
12168
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12372
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12533
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)
150
SetConditionalState(
State
,
State
.Clone());
229
: Dump(this.
State
);
636
SetConditionalState(this.
State
, UnreachableState());
641
SetConditionalState(UnreachableState(), this.
State
);
701
_loopHeadState[node] = this.
State
.Clone();
937
? (
State
, stateWhenNotNull)
938
: (stateWhenNotNull,
State
));
964
SetConditionalState(UnreachableState(), this.
State
);
969
SetConditionalState(this.
State
, UnreachableState());
1182
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
1340
savedState = this.
State
.Clone();
1785
trueState = this.
State
;
1825
var initialState = this.
State
.Clone();
1832
var endState = this.
State
;
2025
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2333
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2601
? (
State
, stateWhenNotNull)
2602
: (stateWhenNotNull,
State
));
2656
? (
State
, stateWhenNotNull)
2657
: (stateWhenNotNull,
State
));
2712
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2746
shortCircuitState =
State
.Clone();
2804
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2859
bodyState = this.
State
;
2881
var breakState = this.
State
.Clone();
2890
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2916
SetConditionalState(stateWhenNotNull,
State
);
2957
savedState =
State
.Clone();
3057
stateWhenNotNull = this.
State
.Clone();
3073
stateWhenNotNull = this.
State
.Clone();
3078
var savedState = this.
State
.Clone();
3109
stateWhenNotNull =
State
;
3127
var savedState = this.
State
.Clone();
3134
savedState = this.
State
.Clone();
3149
var savedState = this.
State
.Clone();
3154
savedState = this.
State
.Clone();
3236
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3244
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3289
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3347
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3358
_labels[label] = this.
State
.Clone();
3413
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3444
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3452
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3479
var savedState = this.
State
;
3625
TLocalState savedState = savedState = this.
State
.Clone();
3731
var savedState = this.
State
.Clone();
3733
leftState = this.
State
.Clone();
3740
var savedState = this.
State
.Clone();
3742
leftState = this.
State
.Clone();
3833
TLocalState initialState = this.
State
.Clone();
3835
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
;
467
if (Diagnostics != null && this.
State
.Reachable)
480
if (!this.
State
.IsAssigned(thisSlot))
491
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);
1947
if (!this.
State
.Reachable)
1972
if (slot > 0 && !this.
State
.IsAssigned(slot))
1983
LocalState result = this.
State
.Clone();
1997
SetConditionalState(this.
State
, whenFail);
2445
LocalState stateAfterLambda = this.
State
;
2447
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2604
if (!this.
State
.Reachable) return;
2746
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
)}{"}"}";
611
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
618
enforceMemberNotNull(syntaxOpt: null, this.
State
);
619
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1858
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1926
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2625
if (this.
State
.Reachable)
2963
var parameterDefaultsNotAssignedState =
State
.Clone();
3043
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3094
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3101
EnforceNotNullIfNotNull(node.Syntax, this.
State
, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3415
var oldState = this.
State
;
3440
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3447
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3449
EnforceParameterNotNullOnExit(null, this.
State
);
3519
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3635
var currentState =
State
;
5075
var stateAfterLeft = this.
State
;
5078
var stateWhenNotNull = this.
State
;
5091
? (
State
, stateWhenNotNull)
5092
: (stateWhenNotNull,
State
));
5175
? (
State
, stateWhenNotNull)
5176
: (stateWhenNotNull,
State
));
5709
var leftState = this.
State
.Clone();
5928
var savedState = this.
State
.Clone();
6054
consequenceState = this.
State
;
6306
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
7901
var newWhenTrue =
State
.Clone();
7907
SetConditionalState(newWhenTrue, whenFalse:
State
);
8702
var savedState = this.
State
.Clone();
10159
var stateForLambda = this.
State
.Clone();
10185
initialState.HasValue ? initialState.Value :
State
.Clone(),
10745
if (this.
State
.Reachable)
11883
SetConditionalState(stateWhenNotNull,
State
);
12153
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;