116 writes to State
Microsoft.CodeAnalysis.CSharp (116)
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;
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
);
2618
Meet(ref stateWhenNotNull, ref
State
);
2743
Join(ref
State
, ref shortCircuitState);
2778
Join(ref shortCircuitState, ref
State
);
2994
Join(ref this.
State
, ref savedState);
3125
Join(ref savedState, ref
State
);
3132
State
= savedState;
3133
Join(ref
State
, ref stateWhenNotNull);
3152
Join(ref this.
State
, ref savedState);
3158
Join(ref this.
State
, ref savedState);
3174
Join(ref this.
State
, ref savedState);
3178
Join(ref this.
State
, ref savedState);
3317
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3379
Join(ref this.
State
, ref state);
3652
this.
State
= savedState;
3769
Join(ref this.
State
, ref leftState);
3861
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)
117
this.
State
= TopState();
FlowAnalysis\DataFlowsInWalker.cs (1)
74
this.
State
= ResetState(this.State);
FlowAnalysis\DefiniteAssignment.cs (14)
189
State
= new LocalState(BitVector.Empty);
208
State
= new LocalState(BitVector.Empty);
230
State
= new LocalState(BitVector.Empty);
393
this.
State
= returnBranch.State;
397
Join(ref savedState, ref this.
State
);
400
this.
State
= savedState;
1162
if (slot >= this.State.Assigned.Capacity) Normalize(ref this.
State
);
1758
SetSlotAssigned(slot, ref this.
State
);
1799
SetSlotUnassigned(slot, ref this.
State
);
2440
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2450
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2453
this.
State
= pending.State;
2464
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2467
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 (48)
880
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1207
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2461
LearnFromNonNullTest(value, ref
State
);
2664
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2777
GetState(ref this.
State
, valueMemberSlot) :
2781
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2875
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
2998
Join(ref
State
, ref parameterDefaultsNotAssignedState);
3013
SetState(ref this.
State
, slot, state);
3443
this.
State
= state.CreateNestedMethodState(_variables);
3506
this.
State
= oldState;
3632
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4252
SetState(ref this.
State
, slot, resultState);
4508
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5536
LearnFromNonNullTest(operand, ref
State
);
5889
LearnFromNullTest(leftOperand, ref this.
State
);
5901
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5911
Join(ref this.
State
, ref leftState);
5938
LearnFromNullTest(leftOperand, ref this.
State
);
6137
Join(ref savedState, ref
State
);
6163
LearnFromNonNullTest(slot, ref
State
);
6169
Join(ref this.
State
, ref savedState);
6190
LearnFromNonNullTest(slot, ref
State
);
6234
Join(ref this.
State
, ref consequenceState);
7669
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7908
LearnFromNonNullTest(argumentNoConversion, ref
State
);
8214
LearnFromNullTest(argument, ref
State
);
8220
LearnFromNonNullTest(argument, ref
State
);
8750
NullableFlowState state = GetState(ref this.
State
, slot);
9032
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
9172
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9189
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9216
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9527
LearnFromNonNullTest(conversionOperand, ref
State
);
9625
LearnFromNonNullTest(conversionOperand, ref
State
);
10018
LearnFromNonNullTest(conversionOperand, ref
State
);
10343
LearnFromNonNullTest(arg, ref
State
);
11090
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11268
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11594
var state = GetState(ref this.
State
, slot);
11969
SetState(ref this.
State
, slot, state);
12413
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12619
SetState(ref this.
State
, memberSlot,
12620
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
12730
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12934
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13095
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);
579
SetState(ref this.
State
, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null
682
var tempState = GetState(ref this.
State
, tempSlot);
797
Join(ref this.
State
, ref stateAndReachable.state.State);
939
Join(ref endState, ref this.
State
);
145 references to State
Microsoft.CodeAnalysis.CSharp (145)
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();
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));
2623
? (
State
, stateWhenNotNull)
2624
: (stateWhenNotNull,
State
));
2678
? (
State
, stateWhenNotNull)
2679
: (stateWhenNotNull,
State
));
2734
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2768
shortCircuitState =
State
.Clone();
2826
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2881
bodyState = this.
State
;
2903
var breakState = this.
State
.Clone();
2912
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2938
SetConditionalState(stateWhenNotNull,
State
);
2979
savedState =
State
.Clone();
3079
stateWhenNotNull = this.
State
.Clone();
3095
stateWhenNotNull = this.
State
.Clone();
3100
var savedState = this.
State
.Clone();
3131
stateWhenNotNull =
State
;
3149
var savedState = this.
State
.Clone();
3156
savedState = this.
State
.Clone();
3171
var savedState = this.
State
.Clone();
3176
savedState = this.
State
.Clone();
3258
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3266
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3311
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3369
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3380
_labels[label] = this.
State
.Clone();
3435
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3466
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3474
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3501
var savedState = this.
State
;
3647
TLocalState savedState = savedState = this.
State
.Clone();
3753
var savedState = this.
State
.Clone();
3755
leftState = this.
State
.Clone();
3762
var savedState = this.
State
.Clone();
3764
leftState = this.
State
.Clone();
3855
TLocalState initialState = this.
State
.Clone();
3857
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)
132
_endOfRegionState = this.
State
.Clone();
FlowAnalysis\ControlFlowPass.cs (6)
108
return new LocalState(false, this.
State
.Reported);
200
return
State
.Alive;
262
if (!this.
State
.Alive &&
263
!this.
State
.Reported &&
269
this.
State
.Reported = true;
376
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)
390
var savedState = this.
State
;
468
if (Diagnostics != null && this.
State
.Reachable)
481
if (!this.
State
.IsAssigned(thisSlot))
492
if (fieldSlot == -1 || !this.
State
.IsAssigned(fieldSlot))
1159
if (this.
State
.Reachable)
1162
if (slot >= this.
State
.Assigned.Capacity) Normalize(ref this.State);
1163
if (slot > 0 && !this.
State
.IsAssigned(slot))
1273
if (slot == -1 || !
State
.IsAssigned(slot))
1371
if (this.
State
.Reachable && !IsAssigned(expr, out int unassignedSlot))
1476
return this.
State
.IsAssigned(unassignedSlot);
1551
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1564
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1948
if (!this.
State
.Reachable)
1973
if (slot > 0 && !this.
State
.IsAssigned(slot))
1984
LocalState result = this.
State
.Clone();
1998
SetConditionalState(this.
State
, whenFail);
2438
LocalState stateAfterLambda = this.
State
;
2440
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2597
if (!this.
State
.Reachable) return;
2741
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 (36)
525
return $"{{{GetType().Name} {Dump(
State
)}{"}"}";
636
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
643
enforceMemberNotNull(syntaxOpt: null, this.
State
);
644
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1884
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1952
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2651
if (this.
State
.Reachable)
2989
var parameterDefaultsNotAssignedState =
State
.Clone();
3069
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3120
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3127
EnforceNotNullIfNotNull(node.Syntax, this.
State
, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3441
var oldState = this.
State
;
3466
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3473
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3475
EnforceParameterNotNullOnExit(null, this.
State
);
3545
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3659
var currentState =
State
;
5191
var stateAfterLeft = this.
State
;
5194
var stateWhenNotNull = this.
State
;
5207
? (
State
, stateWhenNotNull)
5208
: (stateWhenNotNull,
State
));
5291
? (
State
, stateWhenNotNull)
5292
: (stateWhenNotNull,
State
));
5887
var leftState = this.
State
.Clone();
6106
var savedState = this.
State
.Clone();
6232
consequenceState = this.
State
;
6484
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
8127
var newWhenTrue =
State
.Clone();
8133
SetConditionalState(newWhenTrue, whenFalse:
State
);
9006
var savedState = this.
State
.Clone();
10471
var stateForLambda = this.
State
.Clone();
10497
initialState.HasValue ? initialState.Value :
State
.Clone(),
11121
if (this.
State
.Reachable)
12283
var rightState =
State
.Clone();
12445
SetConditionalState(stateWhenNotNull,
State
);
12715
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
);
669
labelStateMap.Add(d.Label, (this.
State
, nodeBelievedReachable));
717
gotoNode(w.WhenTrue, this.
State
, nodeBelievedReachable);
927
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;