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;
1113
if (slot >= this.State.Assigned.Capacity) Normalize(ref this.
State
);
1709
SetSlotAssigned(slot, ref this.
State
);
1750
SetSlotUnassigned(slot, ref this.
State
);
2391
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2401
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2404
this.
State
= pending.State;
2415
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2418
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)
878
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1205
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2459
LearnFromNonNullTest(value, ref
State
);
2662
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2775
GetState(ref this.
State
, valueMemberSlot) :
2779
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2873
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
2996
Join(ref
State
, ref parameterDefaultsNotAssignedState);
3011
SetState(ref this.
State
, slot, state);
3441
this.
State
= state.CreateNestedMethodState(_variables);
3504
this.
State
= oldState;
3630
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4249
SetState(ref this.
State
, slot, resultState);
4505
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5533
LearnFromNonNullTest(operand, ref
State
);
5886
LearnFromNullTest(leftOperand, ref this.
State
);
5898
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5908
Join(ref this.
State
, ref leftState);
5935
LearnFromNullTest(leftOperand, ref this.
State
);
6134
Join(ref savedState, ref
State
);
6160
LearnFromNonNullTest(slot, ref
State
);
6166
Join(ref this.
State
, ref savedState);
6187
LearnFromNonNullTest(slot, ref
State
);
6231
Join(ref this.
State
, ref consequenceState);
7707
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7946
LearnFromNonNullTest(argumentNoConversion, ref
State
);
8252
LearnFromNullTest(argument, ref
State
);
8258
LearnFromNonNullTest(argument, ref
State
);
8788
NullableFlowState state = GetState(ref this.
State
, slot);
9070
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
9210
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9227
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9254
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9565
LearnFromNonNullTest(conversionOperand, ref
State
);
9663
LearnFromNonNullTest(conversionOperand, ref
State
);
10056
LearnFromNonNullTest(conversionOperand, ref
State
);
10381
LearnFromNonNullTest(arg, ref
State
);
11125
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11302
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11628
var state = GetState(ref this.
State
, slot);
12000
SetState(ref this.
State
, slot, state);
12451
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12657
SetState(ref this.
State
, memberSlot,
12658
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
12768
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12972
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13133
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
;
419
if (Diagnostics != null && this.
State
.Reachable)
432
if (!this.
State
.IsAssigned(thisSlot))
443
if (fieldSlot == -1 || !this.
State
.IsAssigned(fieldSlot))
1110
if (this.
State
.Reachable)
1113
if (slot >= this.
State
.Assigned.Capacity) Normalize(ref this.State);
1114
if (slot > 0 && !this.
State
.IsAssigned(slot))
1224
if (slot == -1 || !
State
.IsAssigned(slot))
1322
if (this.
State
.Reachable && !IsAssigned(expr, out int unassignedSlot))
1427
return this.
State
.IsAssigned(unassignedSlot);
1502
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1515
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1899
if (!this.
State
.Reachable)
1924
if (slot > 0 && !this.
State
.IsAssigned(slot))
1935
LocalState result = this.
State
.Clone();
1949
SetConditionalState(this.
State
, whenFail);
2389
LocalState stateAfterLambda = this.
State
;
2391
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2548
if (!this.
State
.Reachable) return;
2692
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
);
1882
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1950
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2649
if (this.
State
.Reachable)
2987
var parameterDefaultsNotAssignedState =
State
.Clone();
3067
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3118
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3125
EnforceNotNullIfNotNull(node.Syntax, this.
State
, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3439
var oldState = this.
State
;
3464
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3471
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3473
EnforceParameterNotNullOnExit(null, this.
State
);
3543
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3657
var currentState =
State
;
5188
var stateAfterLeft = this.
State
;
5191
var stateWhenNotNull = this.
State
;
5204
? (
State
, stateWhenNotNull)
5205
: (stateWhenNotNull,
State
));
5288
? (
State
, stateWhenNotNull)
5289
: (stateWhenNotNull,
State
));
5884
var leftState = this.
State
.Clone();
6103
var savedState = this.
State
.Clone();
6229
consequenceState = this.
State
;
6481
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
8165
var newWhenTrue =
State
.Clone();
8171
SetConditionalState(newWhenTrue, whenFalse:
State
);
9044
var savedState = this.
State
.Clone();
10509
var stateForLambda = this.
State
.Clone();
10535
initialState.HasValue ? initialState.Value :
State
.Clone(),
11156
if (this.
State
.Reachable)
12321
var rightState =
State
.Clone();
12483
SetConditionalState(stateWhenNotNull,
State
);
12753
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;