127 writes to State
Microsoft.CodeAnalysis.CSharp (127)
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);
1376
this.
State
= savedState;
1410
Join(ref
State
, ref localFunctionState.StateFromBottom);
1414
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
);
2619
Meet(ref stateWhenNotNull, ref
State
);
2744
Join(ref
State
, ref shortCircuitState);
2779
Join(ref shortCircuitState, ref
State
);
2995
Join(ref this.
State
, ref savedState);
3126
Join(ref savedState, ref
State
);
3133
State
= savedState;
3134
Join(ref
State
, ref stateWhenNotNull);
3153
Join(ref this.
State
, ref savedState);
3159
Join(ref this.
State
, ref savedState);
3175
Join(ref this.
State
, ref savedState);
3179
Join(ref this.
State
, ref savedState);
3318
Join(ref this.
State
, ref afterConsequenceWhenTrue);
3380
Join(ref this.
State
, ref state);
3653
this.
State
= savedState;
3780
Join(ref this.
State
, ref leftState);
3872
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 (16)
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
);
2379
Meet(ref whenTrue, ref
State
);
2380
Meet(ref whenFalse, ref
State
);
2424
this.
State
= this.State.Reachable ? this.State.Clone() : ReachableBottomState();
2434
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2437
this.
State
= pending.State;
2448
Join(ref stateAfterLambda, ref this.
State
); // a no-op except in region analysis
2451
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);
2498
LearnFromNonNullTest(value, ref
State
);
2701
SetStateAndTrackForFinally(ref this.
State
, targetSlot, newState);
2822
GetState(ref this.
State
, valueMemberSlot) :
2826
SetStateAndTrackForFinally(ref this.
State
, targetMemberSlot, value);
2920
SetStateAndTrackForFinally(ref this.
State
, slot, GetDefaultState(symbol));
3043
Join(ref
State
, ref parameterDefaultsNotAssignedState);
3058
SetState(ref this.
State
, slot, state);
3487
this.
State
= state.CreateNestedMethodState(_variables);
3550
this.
State
= oldState;
3703
SetState(ref this.
State
, slot, GetDefaultState(ref this.
State
, slot));
4458
SetState(ref this.
State
, slot, resultState);
4511
operandState = GetState(ref this.
State
, operandSlot);
4522
SetState(ref this.
State
, iUnionValuePropertySlot, operandState);
4719
if (!initializer.Type.IsValueType && GetState(ref
State
, slot).MayBeNull())
5800
LearnFromNonNullTest(operand, ref
State
);
6153
LearnFromNullTest(leftOperand, ref this.
State
);
6165
SetState(ref this.
State
, leftSlot, NullableFlowState.NotNull);
6175
Join(ref this.
State
, ref leftState);
6202
LearnFromNullTest(leftOperand, ref this.
State
);
6403
Join(ref savedState, ref
State
);
6429
LearnFromNonNullTest(slot, ref
State
);
6435
Join(ref this.
State
, ref savedState);
6456
LearnFromNonNullTest(slot, ref
State
);
6500
Join(ref this.
State
, ref consequenceState);
8013
applyMemberPostConditions(receiverSlot, type, notNullMembers, ref
State
);
8270
LearnFromNonNullTest(argumentNoConversion, ref
State
);
8596
LearnFromNullTest(argument, ref
State
);
8602
LearnFromNonNullTest(argument, ref
State
);
9143
NullableFlowState state = GetState(ref this.
State
, slot);
9425
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
9566
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9583
SetState(ref this.
State
, targetFieldSlot, NullableFlowState.NotNull);
9610
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9627
valueFieldType = TypeWithState.Create(valueFieldType.Type, GetState(ref this.
State
, valueFieldSlot));
9642
SetState(ref this.
State
, conversionOperandSlot, valueFieldType.State);
9662
SetState(ref this.
State
, targetFieldSlot, convertedType.State);
9667
SetState(ref this.
State
, valueFieldSlot, GetState(ref this.
State
, conversionOperandSlot));
10001
LearnFromNonNullTest(conversionOperand, ref
State
);
10114
LearnFromNonNullTest(conversionOperand, ref
State
);
10528
LearnFromNonNullTest(conversionOperand, ref
State
);
10693
LearnFromNonNullTest(conversionOperand, ref
State
);
11025
LearnFromNonNullTest(arg, ref
State
);
11773
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
11966
SetResultType(node, TypeWithState.Create(results[0].RValueType.Type, GetState(ref
State
, extensionReceiverSlot)));
12349
var state = GetState(ref this.
State
, slot);
12722
SetState(ref this.
State
, slot, state);
13171
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13377
SetState(ref this.
State
, memberSlot,
13378
node.IsAddition ? GetState(ref this.
State
, memberSlot).Meet(ResultType.State) : NullableFlowState.MaybeNull);
13488
LearnFromNonNullTest(receiverOpt, ref this.
State
);
13692
SetState(ref this.
State
, slot, NullableFlowState.NotNull);
13907
Join(ref
State
, ref other.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
);
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();
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();
1785
trueState = this.
State
;
1825
var initialState = this.
State
.Clone();
1832
var endState = this.
State
;
2026
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
2335
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2624
? (
State
, stateWhenNotNull)
2625
: (stateWhenNotNull,
State
));
2679
? (
State
, stateWhenNotNull)
2680
: (stateWhenNotNull,
State
));
2735
TLocalState? shortCircuitState = hasConditionalEvaluation ?
State
.Clone() : default;
2769
shortCircuitState =
State
.Clone();
2827
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2882
bodyState = this.
State
;
2904
var breakState = this.
State
.Clone();
2913
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
2939
SetConditionalState(stateWhenNotNull,
State
);
2980
savedState =
State
.Clone();
3080
stateWhenNotNull = this.
State
.Clone();
3096
stateWhenNotNull = this.
State
.Clone();
3101
var savedState = this.
State
.Clone();
3132
stateWhenNotNull =
State
;
3150
var savedState = this.
State
.Clone();
3157
savedState = this.
State
.Clone();
3172
var savedState = this.
State
.Clone();
3177
savedState = this.
State
.Clone();
3259
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3267
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3312
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (
State
,
State
);
3370
PendingBranches.Add(new PendingBranch(node, this.
State
, node.Label));
3381
_labels[label] = this.
State
.Clone();
3436
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3467
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3475
PendingBranches.Add(new PendingBranch(node, this.
State
, null));
3502
var savedState = this.
State
;
3648
TLocalState savedState = savedState = this.
State
.Clone();
3764
var savedState = this.
State
.Clone();
3766
leftState = this.
State
.Clone();
3773
var savedState = this.
State
.Clone();
3775
leftState = this.
State
.Clone();
3866
TLocalState initialState = this.
State
.Clone();
3868
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;
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 (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);
2422
LocalState stateAfterLambda = this.
State
;
2424
this.State = this.
State
.Reachable ? this.
State
.Clone() : ReachableBottomState();
2581
if (!this.
State
.Reachable) return;
2727
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
);
2688
if (this.
State
.Reachable)
3034
var parameterDefaultsNotAssignedState =
State
.Clone();
3114
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3165
PendingBranches.Add(new PendingBranch(node, this.
State
, label: null));
3172
EnforceNotNullIfNotNull(node.Syntax, this.
State
, parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
3485
var oldState = this.
State
;
3510
PendingBranches.Add(new PendingBranch(null, this.
State
, null));
3517
enforceMemberNotNull(((LocalFunctionSymbol)lambdaOrFunctionSymbol).Syntax, this.
State
);
3519
EnforceParameterNotNullOnExit(null, this.
State
);
3589
var state =
State
.GetStateForVariables(localFunctionState.StartingState.Id);
3730
var currentState =
State
;
5455
var stateAfterLeft = this.
State
;
5458
var stateWhenNotNull = this.
State
;
5471
? (
State
, stateWhenNotNull)
5472
: (stateWhenNotNull,
State
));
5555
? (
State
, stateWhenNotNull)
5556
: (stateWhenNotNull,
State
));
6151
var leftState = this.
State
.Clone();
6372
var savedState = this.
State
.Clone();
6498
consequenceState = this.
State
;
6750
=> this.IsConditionalState ? (this.StateWhenTrue.Reachable || this.StateWhenFalse.Reachable) : this.
State
.Reachable;
8490
var newWhenTrue =
State
.Clone();
8496
SetConditionalState(newWhenTrue, whenFalse:
State
);
9399
var savedState = this.
State
.Clone();
11153
var stateForLambda = this.
State
.Clone();
11179
initialState.HasValue ? initialState.Value :
State
.Clone(),
11804
if (this.
State
.Reachable)
13043
var rightState =
State
.Clone();
13203
SetConditionalState(stateWhenNotNull,
State
);
13473
if (receiverOpt != null && this.
State
.Reachable)
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\RegionReachableWalker.cs (3)
27
endPointIsReachable = badRegion || walker._regionEndPointIsReachable.GetValueOrDefault(walker.
State
.Alive);
46
_regionStartPointIsReachable = this.
State
.Alive;
52
_regionEndPointIsReachable = this.
State
.Alive;