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)
880
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1207
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2460
LearnFromNonNullTest(value, ref
State
);
2663
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);
3442
this.
State
= state.CreateNestedMethodState(_variables);
3505
this.
State
= oldState;
3658
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4411
SetState(ref this.
State
, slot, resultState);
4463
operandState = GetState(ref this.
State
, operandSlot);
4474
SetState(ref this.
State
, iUnionValuePropertySlot, operandState);
4734
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5762
LearnFromNonNullTest(operand, ref
State
);
6115
LearnFromNullTest(leftOperand, ref this.
State
);
6127
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
6137
Join(ref this.
State
, ref leftState);
6164
LearnFromNullTest(leftOperand, ref this.
State
);
6365
Join(ref savedState, ref
State
);
6391
LearnFromNonNullTest(slot, ref
State
);
6397
Join(ref this.
State
, ref savedState);
6418
LearnFromNonNullTest(slot, ref
State
);
6462
Join(ref this.
State
, ref consequenceState);
7937
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
8201
LearnFromNonNullTest(argumentNoConversion, ref
State
);
8532
LearnFromNullTest(argument, ref
State
);
8538
LearnFromNonNullTest(argument, ref
State
);
9079
NullableFlowState state = GetState(ref this.
State
, slot);
9361
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
9502
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9519
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9546
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9563
valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.
State
, valueFieldSlot));
9578
SetState(ref this.
State
, conversionOperandSlot, valueFieldType.State);
9599
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9604
SetState(ref this.
State
, valueFieldSlot, GetState(ref this.
State
, conversionOperandSlot));
9939
LearnFromNonNullTest(conversionOperand, ref
State
);
10052
LearnFromNonNullTest(conversionOperand, ref
State
);
10466
LearnFromNonNullTest(conversionOperand, ref
State
);
10625
LearnFromNonNullTest(conversionOperand, ref
State
);
10946
LearnFromNonNullTest(arg, ref
State
);
11694
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11883
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
12226
var state = GetState(ref this.
State
, slot);
12599
SetState(ref this.
State
, slot, state);
13048
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13254
SetState(ref this.
State
, memberSlot,
13255
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
13365
LearnFromNonNullTest(receiverOpt, ref this.
State
);
13569
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13783
Join(ref
State
, ref other.State);
FlowAnalysis\NullableWalker_Patterns.cs (9)
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);
462
SetState(ref
State
, outputSlot, NullableFlowState.NotNull);
514
SetState(ref this.
State
, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null
522
var inputState = GetState(ref this.
State
, inputSlot);
627
var tempState = GetState(ref this.
State
, tempSlot);
904
Join(ref this.
State
, ref stateAndReachable.state.State);
1037
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)
525
return $"{{{GetType().Name} {Dump(
State
)}{"}"}";
637
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
644
enforceMemberNotNull(syntaxOpt: null, this.
State
);
645
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1884
finalNullableState = GetVariableState(walker._variables, walker.
State
);
1952
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2650
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);
3440
var oldState = this.
State
;
3465
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3472
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3474
EnforceParameterNotNullOnExit(null, this.
State
);
3544
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3685
var currentState =
State
;
5417
var stateAfterLeft = this.
State
;
5420
var stateWhenNotNull = this.
State
;
5433
? (
State
, stateWhenNotNull)
5434
: (stateWhenNotNull,
State
));
5517
? (
State
, stateWhenNotNull)
5518
: (stateWhenNotNull,
State
));
6113
var leftState = this.
State
.Clone();
6334
var savedState = this.
State
.Clone();
6460
consequenceState = this.
State
;
6712
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
8420
var newWhenTrue =
State
.Clone();
8426
SetConditionalState(newWhenTrue, whenFalse:
State
);
9335
var savedState = this.
State
.Clone();
11074
var stateForLambda = this.
State
.Clone();
11100
initialState.HasValue ? initialState.Value :
State
.Clone(),
11725
if (this.
State
.Reachable)
12920
var rightState =
State
.Clone();
13080
SetConditionalState(stateWhenNotNull,
State
);
13350
if (receiverOpt != null && this.
State
.Reachable)
FlowAnalysis\NullableWalker_Patterns.cs (6)
37
var currentState =
State
;
307
PendingBranches.Add(new PendingBranch(label, this.
State
, label.Label));
363
: new PossiblyConditionalState(nullableWalker.
State
);
614
labelStateMap.Add(d.Label, (this.
State
, nodeBelievedReachable));
662
gotoNode(w.WhenTrue, this.
State
, nodeBelievedReachable);
1025
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;