127 writes to State
Microsoft.CodeAnalysis.CSharp (127)
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\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);
1190
Join(ref this.
State
, ref shortCircuitState);
1386
this.
State
= savedState;
1420
Join(ref
State
, ref localFunctionState.StateFromBottom);
1424
Meet(ref
State
, ref localFunctionState.StateFromTop);
1819
Join(ref this.
State
, ref trueState);
1847
Join(ref endState, ref this.
State
);
1893
Meet(ref endState, ref this.
State
);
1906
Meet(ref stateToUpdate, ref this.
State
);
2629
Meet(ref stateWhenNotNull, ref
State
);
2754
Join(ref
State
, ref shortCircuitState);
2789
Join(ref shortCircuitState, ref
State
);
3005
Join(ref this.
State
, ref savedState);
3136
Join(ref savedState, ref
State
);
3143
State
= savedState;
3144
Join(ref
State
, ref stateWhenNotNull);
3163
Join(ref this.
State
, ref savedState);
3169
Join(ref this.
State
, ref savedState);
3185
Join(ref this.
State
, ref savedState);
3189
Join(ref this.
State
, ref savedState);
3328
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3390
Join(ref this.
State
, ref state);
3672
this.
State
= savedState;
3799
Join(ref this.
State
, ref leftState);
3891
Join(ref this.
State
, ref afterBlock);
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 (16)
194
State
= new LocalState(BitVector.Empty);
213
State
= new LocalState(BitVector.Empty);
235
State
= new LocalState(BitVector.Empty);
399
this.
State
= returnBranch.State;
403
Join(ref savedState, ref this.
State
);
406
this.
State
= savedState;
1123
if (slot >= this.State.Assigned.Capacity) Normalize(ref this.
State
);
1719
SetSlotAssigned(slot, ref this.
State
);
1760
SetSlotUnassigned(slot, ref this.
State
);
2388
Meet(ref whenTrue, ref
State
);
2389
Meet(ref whenFalse, ref
State
);
2433
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2443
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2446
this.
State
= pending.State;
2457
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2460
this.
State
= stateAfterLambda;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
79
Normalize(ref this.
State
);
FlowAnalysis\LocalDataFlowPass.cs (1)
143
Normalize(ref this.
State
);
FlowAnalysis\NullableWalker_Patterns.cs (9)
176
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
189
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
196
LearnFromNullTest(inputSlot, inputType, ref this.
State
, markDependentSlotsNotNull: false);
466
SetState(ref
State
, outputSlot, NullableFlowState.NotNull);
518
SetState(ref this.
State
, outputSlot, NullableFlowState.NotNull); // Slice value is assumed to be never null
526
var inputState = GetState(ref this.
State
, inputSlot);
631
var tempState = GetState(ref this.
State
, tempSlot);
913
Join(ref this.
State
, ref stateAndReachable.state.State);
1131
Join(ref endState, ref this.
State
);
FlowAnalysis\NullableWalker.cs (56)
909
SetState(ref this.
State
, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull);
1261
SetState(ref this.
State
, memberSlot, NullableFlowState.MaybeNull);
2533
LearnFromNonNullTest(value, ref
State
);
2736
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2857
GetState(ref this.
State
, valueMemberSlot) :
2861
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2955
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(targetSlot, symbol));
3078
Join(ref
State
, ref parameterDefaultsNotAssignedState);
3093
SetState(ref this.
State
, slot, state);
3522
this.
State
= state.CreateNestedMethodState(_variables);
3585
this.
State
= oldState;
3738
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4494
SetState(ref this.
State
, slot, resultState);
4558
operandState = GetState(ref this.
State
, operandSlot);
4574
SetState(ref this.
State
, iUnionValuePropertySlot, state);
4771
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5868
LearnFromNonNullTest(operand, ref
State
);
6221
LearnFromNullTest(leftOperand, ref this.
State
);
6233
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
6243
Join(ref this.
State
, ref leftState);
6270
LearnFromNullTest(leftOperand, ref this.
State
);
6471
Join(ref savedState, ref
State
);
6497
LearnFromNonNullTest(slot, ref
State
);
6503
Join(ref this.
State
, ref savedState);
6524
LearnFromNonNullTest(slot, ref
State
);
6568
Join(ref this.
State
, ref consequenceState);
8088
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
8345
LearnFromNonNullTest(argumentNoConversion, ref
State
);
8671
LearnFromNullTest(argument, ref
State
);
8677
LearnFromNonNullTest(argument, ref
State
);
9218
NullableFlowState state = GetState(ref this.
State
, slot);
9500
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
9641
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9658
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9685
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9702
valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.
State
, valueFieldSlot));
9717
SetState(ref this.
State
, conversionOperandSlot, valueFieldType.State);
9737
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9742
SetState(ref this.
State
, valueFieldSlot, GetState(ref this.
State
, conversionOperandSlot));
10076
LearnFromNonNullTest(conversionOperand, ref
State
);
10189
LearnFromNonNullTest(conversionOperand, ref
State
);
10603
LearnFromNonNullTest(conversionOperand, ref
State
);
10772
LearnFromNonNullTest(conversionOperand, ref
State
);
11104
LearnFromNonNullTest(arg, ref
State
);
11859
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
12052
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
12435
var state = GetState(ref this.
State
, slot);
12817
SetState(ref this.
State
, slot, state);
13266
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13472
SetState(ref this.
State
, memberSlot,
13473
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
13583
LearnFromNonNullTest(receiverOpt, ref this.
State
);
13787
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
14010
Join(ref
State
, ref other.State);
145 references to State
Microsoft.CodeAnalysis.CSharp (145)
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\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();
938
? (
State
, stateWhenNotNull)
939
: (stateWhenNotNull,
State
));
965
SetConditionalState(UnreachableState(), this.
State
);
970
SetConditionalState(this.
State
, UnreachableState());
1183
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
1341
savedState = this.
State
.Clone();
1795
trueState = this.
State
;
1835
var initialState = this.
State
.Clone();
1842
var endState = this.
State
;
2036
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2345
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2634
? (
State
, stateWhenNotNull)
2635
: (stateWhenNotNull,
State
));
2689
? (
State
, stateWhenNotNull)
2690
: (stateWhenNotNull,
State
));
2745
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2779
shortCircuitState =
State
.Clone();
2837
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2892
bodyState = this.
State
;
2914
var breakState = this.
State
.Clone();
2923
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2949
SetConditionalState(stateWhenNotNull,
State
);
2990
savedState =
State
.Clone();
3090
stateWhenNotNull = this.
State
.Clone();
3106
stateWhenNotNull = this.
State
.Clone();
3111
var savedState = this.
State
.Clone();
3142
stateWhenNotNull =
State
;
3160
var savedState = this.
State
.Clone();
3167
savedState = this.
State
.Clone();
3182
var savedState = this.
State
.Clone();
3187
savedState = this.
State
.Clone();
3269
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3277
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3322
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3380
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3391
_labels[label] = this.
State
.Clone();
3446
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3477
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3485
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3512
var savedState = this.
State
;
3667
TLocalState savedState = savedState = this.
State
.Clone();
3783
var savedState = this.
State
.Clone();
3785
leftState = this.
State
.Clone();
3792
var savedState = this.
State
.Clone();
3794
leftState = this.
State
.Clone();
3885
TLocalState initialState = this.
State
.Clone();
3887
TLocalState afterBlock = 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;
267
if (!this.
State
.Alive &&
268
!this.
State
.Reported &&
274
this.
State
.Reported = true;
396
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 (22)
396
var savedState = this.
State
;
425
if (Diagnostics != null && this.
State
.Reachable)
438
if (!this.
State
.IsAssigned(thisSlot))
449
if (fieldSlot == -1 || !this.
State
.IsAssigned(fieldSlot))
1120
if (this.
State
.Reachable)
1123
if (slot >= this.
State
.Assigned.Capacity) Normalize(ref this.State);
1124
if (slot > 0 && !this.
State
.IsAssigned(slot))
1234
if (slot == -1 || !
State
.IsAssigned(slot))
1332
if (this.
State
.Reachable && !IsAssigned(expr, out int unassignedSlot))
1437
return this.
State
.IsAssigned(unassignedSlot);
1512
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1525
SetSlotState(slot, assigned: written || !this.
State
.Reachable);
1909
if (!this.
State
.Reachable)
1934
if (slot > 0 && !this.
State
.IsAssigned(slot))
1945
LocalState result = this.
State
.Clone();
1959
SetConditionalState(this.
State
, whenFail);
2431
LocalState stateAfterLambda = this.
State
;
2433
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2579
this.
State
.Reachable &&
2620
if (!this.
State
.Reachable) return;
2766
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_Patterns.cs (6)
39
var currentState =
State
;
310
PendingBranches.Add(new PendingBranch(label, this.
State
, label.Label));
366
: new PossiblyConditionalState(nullableWalker.
State
);
618
labelStateMap.Add(d.Label, (this.
State
, nodeBelievedReachable));
666
gotoNode(w.WhenTrue, this.
State
, nodeBelievedReachable, from: w, whenTrueBranch: true);
1119
if (!
State
.Reachable && arm.WhenClause != null)
FlowAnalysis\NullableWalker.cs (36)
542
return $"{{{GetType().Name} {Dump(
State
)}{"}"}";
656
_snapshotBuilderOpt?.TakeIncrementalSnapshot(methodMainNode,
State
);
663
enforceMemberNotNull(syntaxOpt: null, this.
State
);
664
EnforceParameterNotNullOnExit(syntaxOpt: null, this.
State
);
1938
finalNullableState = GetVariableState(walker._variables, walker.
State
);
2006
_snapshotBuilderOpt?.TakeIncrementalSnapshot(node,
State
);
2723
if (this.
State
.Reachable)
3069
var parameterDefaultsNotAssignedState =
State
.Clone();
3149
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3200
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3207
EnforceNotNullIfNotNull(node.Syntax, this.
State
, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3520
var oldState = this.
State
;
3545
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3552
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3554
EnforceParameterNotNullOnExit(null, this.
State
);
3624
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3765
var currentState =
State
;
5507
var stateAfterLeft = this.
State
;
5510
var stateWhenNotNull = this.
State
;
5523
? (
State
, stateWhenNotNull)
5524
: (stateWhenNotNull,
State
));
5607
? (
State
, stateWhenNotNull)
5608
: (stateWhenNotNull,
State
));
6219
var leftState = this.
State
.Clone();
6440
var savedState = this.
State
.Clone();
6566
consequenceState = this.
State
;
6818
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
8565
var newWhenTrue =
State
.Clone();
8571
SetConditionalState(newWhenTrue, whenFalse:
State
);
9474
var savedState = this.
State
.Clone();
11232
var stateForLambda = this.
State
.Clone();
11258
initialState.HasValue ? initialState.Value :
State
.Clone(),
11890
if (this.
State
.Reachable)
13138
var rightState =
State
.Clone();
13298
SetConditionalState(stateWhenNotNull,
State
);
13568
if (receiverOpt != null && this.
State
.Reachable)
FlowAnalysis\RegionReachableWalker.cs (3)
27
endPointIsReachable = badRegion || walker._regionEndPointIsReachable.GetValueOrDefault(walker.
State
.Alive);
46
_regionStartPointIsReachable = this.
State
.Alive;
52
_regionEndPointIsReachable = this.
State
.Alive;