5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
14064
return new
LocalState
(snapshot.Id, container, snapshot.State.Clone());
14093
return new
LocalState
(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true));
14116
return new
LocalState
(variables.Id, container, CreateBitVector(reachable));
14122
return new
LocalState
(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true));
14322
return new
LocalState
(Id, container, _state.Clone());
142 references to LocalState
Microsoft.CodeAnalysis.CSharp (142)
FlowAnalysis\NullableWalker_Patterns.cs (21)
39
var
currentState = State;
276
protected override
LocalState
VisitSwitchStatementDispatch(BoundSwitchStatement node)
314
var
afterSwitchState = labelStateMap.TryGetValue(node.BreakLabel, out var stateAndReachable) ? stateAndReachable.state : UnreachableState();
342
public
LocalState
State;
343
public
LocalState
StateWhenTrue;
344
public
LocalState
StateWhenFalse;
347
public PossiblyConditionalState(
LocalState
stateWhenTrue,
LocalState
stateWhenFalse)
355
public PossiblyConditionalState(
LocalState
state)
377
private PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> LearnFromDecisionDag(
421
var labelStateMap = PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)>.GetInstance();
842
void learnFromNonNullTest(int inputSlot, ref
LocalState
state)
922
void gotoNode(BoundDecisionDagNode node,
LocalState
state, bool believedReachable, BoundDecisionDagNode from, bool whenTrueBranch)
1083
var
endState = UnreachableState();
1181
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1195
var
armState = getStateForArm(arm, labelStateMap);
1226
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1238
LocalState
getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap)
1255
var
trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState();
1256
var
falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();
FlowAnalysis\NullableWalker.cs (120)
27
: LocalDataFlowPass<NullableWalker.
LocalState
, NullableWalker.LocalFunctionState>
123
public readonly Optional<
LocalState
> StateForLambda;
139
public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<
LocalState
> stateForLambda)
272
/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional<
LocalState
>,bool, int, Location, ArrayBuilder<VisitResult>)"/>.
681
void enforceMemberNotNull(SyntaxNode? syntaxOpt,
LocalState
state)
760
void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member,
LocalState
state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
1133
private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt,
LocalState
state, MethodSymbol method, string memberName)
1183
void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members,
LocalState
state,
LocalState
otherState)
1195
void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense,
LocalState
state)
1211
private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member,
LocalState
state)
1220
private bool FailsMemberNotNullExpectation(Symbol member,
LocalState
state)
1351
private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt,
LocalState
state)
1397
private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense,
LocalState
stateWhen)
1410
private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1419
bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1457
private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt,
LocalState
state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam)
1760
Analyze(walker, symbol, diagnostics: null,
LocalState
.Create(localState), snapshotBuilderOpt: newSnapshotBuilder);
1881
var
localState =
LocalState
.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables);
1934
Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<
LocalState
>)default :
LocalState
.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis);
1951
Optional<
LocalState
> initialState,
2045
private NullableFlowState GetState(ref
LocalState
state, int slot)
2054
private void SetState(ref
LocalState
state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false)
2063
private void NormalizeIfNeeded(ref
LocalState
state, int slot, bool useNotNullsAsDefault)
2068
protected override void Normalize(ref
LocalState
state)
2076
private NullableFlowState GetDefaultState(ref
LocalState
state, int slot)
2917
private void SetStateAndTrackForFinally(ref
LocalState
state, int slot, NullableFlowState newState)
2923
var
tryState = NonMonotonicState.Value;
2932
protected override void JoinTryBlockState(ref
LocalState
self, ref
LocalState
other)
2934
var
tryState = other.GetStateForVariables(self.Id);
3028
protected override
LocalState
TopState()
3030
var
state =
LocalState
.ReachableState(_variables);
3035
protected override
LocalState
UnreachableState()
3037
return
LocalState
.UnreachableState(_variables);
3040
protected override
LocalState
ReachableBottomState()
3043
return
LocalState
.ReachableStateWithNotNulls(_variables);
3076
var
parameterDefaultsNotAssignedState = State.Clone();
3201
var
joinedState = this.StateWhenTrue.Clone();
3432
var
state = TopState();
3458
var
startingState = localFunctionState.StartingState;
3501
LocalState
state,
3527
var
oldState = this.State;
3604
void enforceMemberNotNull(SyntaxNode? syntax,
LocalState
state)
3631
var
state = State.GetStateForVariables(localFunctionState.StartingState.Id);
3772
var
currentState = State;
4997
private void SetNotNullResultForLambda(BoundExpression node,
LocalState
stateForLambda)
5497
var
stateAfterLeft = this.State;
5500
var
stateWhenNotNull = this.State;
5556
LocalState
getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull)
5558
LocalState
stateWhenNotNull;
5594
var
stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull);
5943
ref
LocalState
stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse;
5949
protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref
LocalState
shortCircuitState)
6054
private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref
LocalState
stateToUpdate)
6062
private void LearnFromNonNullTest(BoundExpression expression, ref
LocalState
state)
6085
private void LearnFromNonNullTest(int slot, ref
LocalState
state)
6090
private void LearnFromNullTest(BoundExpression expression, ref
LocalState
state)
6108
private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref
LocalState
state, bool markDependentSlotsNotNull)
6128
private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref
LocalState
state, int depth = 2)
6209
var
leftState = this.State.Clone();
6430
var
savedState = this.State.Clone();
6539
var
consequenceState = this.StateWhenTrue;
6540
var
alternativeState = this.StateWhenFalse;
6665
BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative,
LocalState
consequenceState,
LocalState
alternativeState,
6712
LocalState
consequenceState,
6713
LocalState
alternativeState,
6733
(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(
LocalState
state, BoundExpression operand)
6746
(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(
LocalState
state, BoundExpression operand)
6769
LocalState
state,
8097
void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref
LocalState
state)
8110
void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref
LocalState
state)
8138
LocalState
markMemberAsNotNull(int receiverSlot, ref
LocalState
state, Symbol member)
8542
var
originalWhenFalse = StateWhenFalse.Clone();
8548
var
newWhenTrue = State.Clone();
8729
private static VariableState GetVariableState(Variables variables,
LocalState
localState)
9457
var
savedState = this.State.Clone();
9898
Optional<
LocalState
> stateForLambda = default,
11215
var
stateForLambda = this.State.Clone();
11227
private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<
LocalState
> initialState = default)
13091
var
leftTrue = this.StateWhenTrue;
13092
var
leftFalse = this.StateWhenFalse;
13108
var
leftTrue = this.StateWhenTrue;
13109
var
leftFalse = this.StateWhenFalse;
13121
var
rightState = State.Clone();
13138
var
leftState = isAnd ? leftFalse : leftTrue;
13175
protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref
LocalState
leftTrue, ref
LocalState
leftFalse)
13268
LocalState
stateWhenNotNull;
13930
protected override string Dump(
LocalState
state)
13935
protected override bool Meet(ref
LocalState
self, ref
LocalState
other)
13952
protected override bool Join(ref
LocalState
self, ref
LocalState
other)
13989
private
LocalState
CloneAndUnsplit(ref PossiblyConditionalState conditionalState)
13996
var
state = conditionalState.StateWhenTrue.Clone();
14038
internal
LocalState
Value;
14040
internal Boxed(
LocalState
value)
14061
internal static
LocalState
Create(LocalStateSnapshot snapshot)
14076
public static
LocalState
ReachableState(Variables variables)
14081
public static
LocalState
UnreachableState(Variables variables)
14086
public static
LocalState
ReachableStateWithNotNulls(Variables variables)
14110
private static
LocalState
CreateReachableOrUnreachableState(Variables variables, bool reachable)
14119
public
LocalState
CreateNestedMethodState(Variables variables)
14148
bool hasVariableCore(ref
LocalState
state, int id, int index)
14166
static bool hasValue(ref
LocalState
state, int slot)
14176
static bool hasValueCore(ref
LocalState
state, int id, int index)
14305
internal
LocalState
GetStateForVariables(int id)
14307
var
state = this;
14319
public
LocalState
Clone()
14325
public bool Join(in
LocalState
other)
14354
public bool Meet(in
LocalState
other)
14445
public
LocalState
StartingState;
14447
public LocalFunctionState(
LocalState
unreachableState)
14459
return new LocalFunctionState(
LocalState
.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
208
internal void TakeIncrementalSnapshot(BoundNode? node,
LocalState
currentState)