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;
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
);
2617
Meet(ref stateWhenNotNull, ref
State
);
2742
Join(ref
State
, ref shortCircuitState);
2777
Join(ref shortCircuitState, ref
State
);
2993
Join(ref this.
State
, ref savedState);
3124
Join(ref savedState, ref
State
);
3131
State
= savedState;
3132
Join(ref
State
, ref stateWhenNotNull);
3151
Join(ref this.
State
, ref savedState);
3157
Join(ref this.
State
, ref savedState);
3173
Join(ref this.
State
, ref savedState);
3177
Join(ref this.
State
, ref savedState);
3316
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3378
Join(ref this.
State
, ref state);
3651
this.
State
= savedState;
3768
Join(ref this.
State
, ref leftState);
3860
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
);
2448
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2458
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2461
this.
State
= pending.State;
2472
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2475
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)
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));
4228
SetState(ref this.
State
, slot, resultState);
4446
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5474
LearnFromNonNullTest(operand, ref
State
);
5827
LearnFromNullTest(leftOperand, ref this.
State
);
5839
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
5849
Join(ref this.
State
, ref leftState);
5876
LearnFromNullTest(leftOperand, ref this.
State
);
6075
Join(ref savedState, ref
State
);
6101
LearnFromNonNullTest(slot, ref
State
);
6107
Join(ref this.
State
, ref savedState);
6128
LearnFromNonNullTest(slot, ref
State
);
6172
Join(ref this.
State
, ref consequenceState);
7611
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
7850
LearnFromNonNullTest(argumentNoConversion, ref
State
);
8156
LearnFromNullTest(argument, ref
State
);
8162
LearnFromNonNullTest(argument, ref
State
);
8646
NullableFlowState state = GetState(ref this.
State
, slot);
8927
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
9067
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9084
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9111
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9422
LearnFromNonNullTest(conversionOperand, ref
State
);
9520
LearnFromNonNullTest(conversionOperand, ref
State
);
9905
LearnFromNonNullTest(conversionOperand, ref
State
);
10230
LearnFromNonNullTest(arg, ref
State
);
10977
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11155
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11475
var state = GetState(ref this.
State
, slot);
11844
SetState(ref this.
State
, slot, state);
12288
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12494
SetState(ref this.
State
, memberSlot,
12495
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
12605
LearnFromNonNullTest(receiverOpt, ref this.
State
);
12809
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
12970
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
);
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();
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));
2622
? (
State
, stateWhenNotNull)
2623
: (stateWhenNotNull,
State
));
2677
? (
State
, stateWhenNotNull)
2678
: (stateWhenNotNull,
State
));
2733
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2767
shortCircuitState =
State
.Clone();
2825
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2880
bodyState = this.
State
;
2902
var breakState = this.
State
.Clone();
2911
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2937
SetConditionalState(stateWhenNotNull,
State
);
2978
savedState =
State
.Clone();
3078
stateWhenNotNull = this.
State
.Clone();
3094
stateWhenNotNull = this.
State
.Clone();
3099
var savedState = this.
State
.Clone();
3130
stateWhenNotNull =
State
;
3148
var savedState = this.
State
.Clone();
3155
savedState = this.
State
.Clone();
3170
var savedState = this.
State
.Clone();
3175
savedState = this.
State
.Clone();
3257
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3265
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3310
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3368
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3379
_labels[label] = this.
State
.Clone();
3434
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3465
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3473
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3500
var savedState = this.
State
;
3646
TLocalState savedState = savedState = this.
State
.Clone();
3752
var savedState = this.
State
.Clone();
3754
leftState = this.
State
.Clone();
3761
var savedState = this.
State
.Clone();
3763
leftState = this.
State
.Clone();
3854
TLocalState initialState = this.
State
.Clone();
3856
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);
2446
LocalState stateAfterLambda = this.
State
;
2448
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2605
if (!this.
State
.Reachable) return;
2747
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)
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
;
5129
var stateAfterLeft = this.
State
;
5132
var stateWhenNotNull = this.
State
;
5145
? (
State
, stateWhenNotNull)
5146
: (stateWhenNotNull,
State
));
5229
? (
State
, stateWhenNotNull)
5230
: (stateWhenNotNull,
State
));
5825
var leftState = this.
State
.Clone();
6044
var savedState = this.
State
.Clone();
6170
consequenceState = this.
State
;
6422
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
8069
var newWhenTrue =
State
.Clone();
8075
SetConditionalState(newWhenTrue, whenFalse:
State
);
8901
var savedState = this.
State
.Clone();
10358
var stateForLambda = this.
State
.Clone();
10384
initialState.HasValue ? initialState.Value :
State
.Clone(),
11008
if (this.
State
.Reachable)
12158
var rightState =
State
.Clone();
12320
SetConditionalState(stateWhenNotNull,
State
);
12590
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;