125 writes to State
Microsoft.CodeAnalysis.CSharp (125)
FlowAnalysis\AbstractFlowPass.cs (31)
133
State
= default(TLocalState);
143
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);
1238
Join(ref this.
State
, ref shortCircuitState);
1424
this.
State
= savedState;
1458
Join(ref
State
, ref localFunctionState.StateFromBottom);
1462
Meet(ref
State
, ref localFunctionState.StateFromTop);
1857
Join(ref this.
State
, ref trueState);
1885
Join(ref endState, ref this.
State
);
1931
Meet(ref endState, ref this.
State
);
1944
Meet(ref stateToUpdate, ref this.
State
);
2667
Meet(ref stateWhenNotNull, ref
State
);
2792
Join(ref
State
, ref shortCircuitState);
2827
Join(ref shortCircuitState, ref
State
);
3043
Join(ref this.
State
, ref savedState);
3174
Join(ref savedState, ref
State
);
3181
State
= savedState;
3182
Join(ref
State
, ref stateWhenNotNull);
3201
Join(ref this.
State
, ref savedState);
3207
Join(ref this.
State
, ref savedState);
3223
Join(ref this.
State
, ref savedState);
3227
Join(ref this.
State
, ref savedState);
3366
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3428
Join(ref this.
State
, ref state);
3701
this.
State
= savedState;
3828
Join(ref this.
State
, ref leftState);
3920
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;
1114
if (slot >= this.State.Assigned.Capacity) Normalize(ref this.
State
);
1710
SetSlotAssigned(slot, ref this.
State
);
1751
SetSlotUnassigned(slot, ref this.
State
);
2392
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2402
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2405
this.
State
= pending.State;
2416
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2419
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 (56)
897
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1224
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2496
LearnFromNonNullTest(value, ref
State
);
2699
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2813
GetState(ref this.
State
, valueMemberSlot) :
2817
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2911
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
3034
Join(ref
State
, ref parameterDefaultsNotAssignedState);
3049
SetState(ref this.
State
, slot, state);
3478
this.
State
= state.CreateNestedMethodState(_variables);
3541
this.
State
= oldState;
3694
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4449
SetState(ref this.
State
, slot, resultState);
4502
operandState = GetState(ref this.
State
, operandSlot);
4513
SetState(ref this.
State
, iUnionValuePropertySlot, operandState);
4773
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5802
LearnFromNonNullTest(operand, ref
State
);
6155
LearnFromNullTest(leftOperand, ref this.
State
);
6167
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
6177
Join(ref this.
State
, ref leftState);
6204
LearnFromNullTest(leftOperand, ref this.
State
);
6405
Join(ref savedState, ref
State
);
6431
LearnFromNonNullTest(slot, ref
State
);
6437
Join(ref this.
State
, ref savedState);
6458
LearnFromNonNullTest(slot, ref
State
);
6502
Join(ref this.
State
, ref consequenceState);
7986
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
8243
LearnFromNonNullTest(argumentNoConversion, ref
State
);
8569
LearnFromNullTest(argument, ref
State
);
8575
LearnFromNonNullTest(argument, ref
State
);
9116
NullableFlowState state = GetState(ref this.
State
, slot);
9398
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
9539
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9556
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9583
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9600
valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.
State
, valueFieldSlot));
9615
SetState(ref this.
State
, conversionOperandSlot, valueFieldType.State);
9635
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9640
SetState(ref this.
State
, valueFieldSlot, GetState(ref this.
State
, conversionOperandSlot));
9974
LearnFromNonNullTest(conversionOperand, ref
State
);
10087
LearnFromNonNullTest(conversionOperand, ref
State
);
10501
LearnFromNonNullTest(conversionOperand, ref
State
);
10664
LearnFromNonNullTest(conversionOperand, ref
State
);
10996
LearnFromNonNullTest(arg, ref
State
);
11745
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11938
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
12281
var state = GetState(ref this.
State
, slot);
12654
SetState(ref this.
State
, slot, state);
13103
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13309
SetState(ref this.
State
, memberSlot,
13310
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
13420
LearnFromNonNullTest(receiverOpt, ref this.
State
);
13624
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13839
Join(ref
State
, ref other.State);
FlowAnalysis\NullableWalker_Patterns.cs (9)
175
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
188
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
195
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
464
SetState(ref
State
, outputSlot, NullableFlowState.NotNull);
516
SetState(ref this.
State
, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null
524
var inputState = GetState(ref this.
State
, inputSlot);
629
var tempState = GetState(ref this.
State
, tempSlot);
906
Join(ref this.
State
, ref stateAndReachable.state.State);
1039
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
);
637
SetConditionalState(this.
State
, UnreachableState());
642
SetConditionalState(UnreachableState(), this.
State
);
702
_loopHeadState[node] = this.
State
.Clone();
986
? (
State
, stateWhenNotNull)
987
: (stateWhenNotNull,
State
));
1013
SetConditionalState(UnreachableState(), this.
State
);
1018
SetConditionalState(this.
State
, UnreachableState());
1231
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
1389
savedState = this.
State
.Clone();
1833
trueState = this.
State
;
1873
var initialState = this.
State
.Clone();
1880
var endState = this.
State
;
2074
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2383
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2672
? (
State
, stateWhenNotNull)
2673
: (stateWhenNotNull,
State
));
2727
? (
State
, stateWhenNotNull)
2728
: (stateWhenNotNull,
State
));
2783
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2817
shortCircuitState =
State
.Clone();
2875
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2930
bodyState = this.
State
;
2952
var breakState = this.
State
.Clone();
2961
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2987
SetConditionalState(stateWhenNotNull,
State
);
3028
savedState =
State
.Clone();
3128
stateWhenNotNull = this.
State
.Clone();
3144
stateWhenNotNull = this.
State
.Clone();
3149
var savedState = this.
State
.Clone();
3180
stateWhenNotNull =
State
;
3198
var savedState = this.
State
.Clone();
3205
savedState = this.
State
.Clone();
3220
var savedState = this.
State
.Clone();
3225
savedState = this.
State
.Clone();
3307
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3315
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3360
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3418
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3429
_labels[label] = this.
State
.Clone();
3484
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3515
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3523
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3550
var savedState = this.
State
;
3696
TLocalState savedState = savedState = this.
State
.Clone();
3812
var savedState = this.
State
.Clone();
3814
leftState = this.
State
.Clone();
3821
var savedState = this.
State
.Clone();
3823
leftState = this.
State
.Clone();
3914
TLocalState initialState = this.
State
.Clone();
3916
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;
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)
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))
1111
if (this.
State
.Reachable)
1114
if (slot >= this.
State
.Assigned.Capacity) Normalize(ref this.State);
1115
if (slot > 0 && !this.
State
.IsAssigned(slot))
1225
if (slot == -1 || !
State
.IsAssigned(slot))
1323
if (this.
State
.Reachable && !IsAssigned(expr, out int unassignedSlot))
1428
return this.
State
.IsAssigned(unassignedSlot);
1503
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1516
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1900
if (!this.
State
.Reachable)
1925
if (slot > 0 && !this.
State
.IsAssigned(slot))
1936
LocalState result = this.
State
.Clone();
1950
SetConditionalState(this.
State
, whenFail);
2390
LocalState stateAfterLambda = this.
State
;
2392
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2549
if (!this.
State
.Reachable) return;
2695
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)
542
return $"{{{GetType().Name} {Dump(
State
)}{"}"}";
654
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
661
enforceMemberNotNull(syntaxOpt: null, this.
State
);
662
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1901
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1969
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2686
if (this.
State
.Reachable)
3025
var parameterDefaultsNotAssignedState =
State
.Clone();
3105
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3156
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3163
EnforceNotNullIfNotNull(node.Syntax, this.
State
, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3476
var oldState = this.
State
;
3501
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3508
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3510
EnforceParameterNotNullOnExit(null, this.
State
);
3580
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3721
var currentState =
State
;
5457
var stateAfterLeft = this.
State
;
5460
var stateWhenNotNull = this.
State
;
5473
? (
State
, stateWhenNotNull)
5474
: (stateWhenNotNull,
State
));
5557
? (
State
, stateWhenNotNull)
5558
: (stateWhenNotNull,
State
));
6153
var leftState = this.
State
.Clone();
6374
var savedState = this.
State
.Clone();
6500
consequenceState = this.
State
;
6752
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
8463
var newWhenTrue =
State
.Clone();
8469
SetConditionalState(newWhenTrue, whenFalse:
State
);
9372
var savedState = this.
State
.Clone();
11124
var stateForLambda = this.
State
.Clone();
11150
initialState.HasValue ? initialState.Value :
State
.Clone(),
11776
if (this.
State
.Reachable)
12975
var rightState =
State
.Clone();
13135
SetConditionalState(stateWhenNotNull,
State
);
13405
if (receiverOpt != null && this.
State
.Reachable)
FlowAnalysis\NullableWalker_Patterns.cs (6)
38
var currentState =
State
;
309
PendingBranches.Add(new PendingBranch(label, this.
State
, label.Label));
365
: new PossiblyConditionalState(nullableWalker.
State
);
616
labelStateMap.Add(d.Label, (this.
State
, nodeBelievedReachable));
664
gotoNode(w.WhenTrue, this.
State
, nodeBelievedReachable);
1027
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;