5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
13918
return new
LocalState
(snapshot.Id, container, snapshot.State.Clone());
13947
return new
LocalState
(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true));
13970
return new
LocalState
(variables.Id, container, CreateBitVector(reachable));
13976
return new
LocalState
(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true));
14176
return new
LocalState
(Id, container, _state.Clone());
142 references to LocalState
Microsoft.CodeAnalysis.CSharp (142)
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>)"/>.
679
void enforceMemberNotNull(SyntaxNode? syntaxOpt,
LocalState
state)
758
void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member,
LocalState
state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
1096
private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt,
LocalState
state, MethodSymbol method, string memberName)
1146
void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members,
LocalState
state,
LocalState
otherState)
1158
void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense,
LocalState
state)
1174
private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member,
LocalState
state)
1183
private bool FailsMemberNotNullExpectation(Symbol member,
LocalState
state)
1314
private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt,
LocalState
state)
1360
private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense,
LocalState
stateWhen)
1373
private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1382
bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1420
private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt,
LocalState
state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam)
1723
Analyze(walker, symbol, diagnostics: null,
LocalState
.Create(localState), snapshotBuilderOpt: newSnapshotBuilder);
1844
var
localState =
LocalState
.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables);
1897
Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<
LocalState
>)default :
LocalState
.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis);
1914
Optional<
LocalState
> initialState,
2008
private NullableFlowState GetState(ref
LocalState
state, int slot)
2017
private void SetState(ref
LocalState
state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false)
2026
private void NormalizeIfNeeded(ref
LocalState
state, int slot, bool useNotNullsAsDefault)
2031
protected override void Normalize(ref
LocalState
state)
2039
private NullableFlowState GetDefaultState(ref
LocalState
state, int slot)
2866
private void SetStateAndTrackForFinally(ref
LocalState
state, int slot, NullableFlowState newState)
2872
var
tryState = NonMonotonicState.Value;
2881
protected override void JoinTryBlockState(ref
LocalState
self, ref
LocalState
other)
2883
var
tryState = other.GetStateForVariables(self.Id);
2977
protected override
LocalState
TopState()
2979
var
state =
LocalState
.ReachableState(_variables);
2984
protected override
LocalState
UnreachableState()
2986
return
LocalState
.UnreachableState(_variables);
2989
protected override
LocalState
ReachableBottomState()
2992
return
LocalState
.ReachableStateWithNotNulls(_variables);
3025
var
parameterDefaultsNotAssignedState = State.Clone();
3150
var
joinedState = this.StateWhenTrue.Clone();
3381
var
state = TopState();
3407
var
startingState = localFunctionState.StartingState;
3450
LocalState
state,
3476
var
oldState = this.State;
3553
void enforceMemberNotNull(SyntaxNode? syntax,
LocalState
state)
3580
var
state = State.GetStateForVariables(localFunctionState.StartingState.Id);
3721
var
currentState = State;
4957
private void SetNotNullResultForLambda(BoundExpression node,
LocalState
stateForLambda)
5457
var
stateAfterLeft = this.State;
5460
var
stateWhenNotNull = this.State;
5516
LocalState
getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull)
5518
LocalState
stateWhenNotNull;
5554
var
stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull);
5887
ref
LocalState
stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse;
5893
protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref
LocalState
shortCircuitState)
5998
private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref
LocalState
stateToUpdate)
6006
private void LearnFromNonNullTest(BoundExpression expression, ref
LocalState
state)
6029
private void LearnFromNonNullTest(int slot, ref
LocalState
state)
6034
private void LearnFromNullTest(BoundExpression expression, ref
LocalState
state)
6052
private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref
LocalState
state, bool markDependentSlotsNotNull)
6072
private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref
LocalState
state, int depth = 2)
6153
var
leftState = this.State.Clone();
6374
var
savedState = this.State.Clone();
6483
var
consequenceState = this.StateWhenTrue;
6484
var
alternativeState = this.StateWhenFalse;
6609
BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative,
LocalState
consequenceState,
LocalState
alternativeState,
6656
LocalState
consequenceState,
6657
LocalState
alternativeState,
6677
(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(
LocalState
state, BoundExpression operand)
6690
(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(
LocalState
state, BoundExpression operand)
6713
LocalState
state,
8012
void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref
LocalState
state)
8025
void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref
LocalState
state)
8053
LocalState
markMemberAsNotNull(int receiverSlot, ref
LocalState
state, Symbol member)
8457
var
originalWhenFalse = StateWhenFalse.Clone();
8463
var
newWhenTrue = State.Clone();
8644
private static VariableState GetVariableState(Variables variables,
LocalState
localState)
9372
var
savedState = this.State.Clone();
9813
Optional<
LocalState
> stateForLambda = default,
11124
var
stateForLambda = this.State.Clone();
11136
private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<
LocalState
> initialState = default)
12945
var
leftTrue = this.StateWhenTrue;
12946
var
leftFalse = this.StateWhenFalse;
12962
var
leftTrue = this.StateWhenTrue;
12963
var
leftFalse = this.StateWhenFalse;
12975
var
rightState = State.Clone();
12992
var
leftState = isAnd ? leftFalse : leftTrue;
13029
protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref
LocalState
leftTrue, ref
LocalState
leftFalse)
13122
LocalState
stateWhenNotNull;
13784
protected override string Dump(
LocalState
state)
13789
protected override bool Meet(ref
LocalState
self, ref
LocalState
other)
13806
protected override bool Join(ref
LocalState
self, ref
LocalState
other)
13843
private
LocalState
CloneAndUnsplit(ref PossiblyConditionalState conditionalState)
13850
var
state = conditionalState.StateWhenTrue.Clone();
13892
internal
LocalState
Value;
13894
internal Boxed(
LocalState
value)
13915
internal static
LocalState
Create(LocalStateSnapshot snapshot)
13930
public static
LocalState
ReachableState(Variables variables)
13935
public static
LocalState
UnreachableState(Variables variables)
13940
public static
LocalState
ReachableStateWithNotNulls(Variables variables)
13964
private static
LocalState
CreateReachableOrUnreachableState(Variables variables, bool reachable)
13973
public
LocalState
CreateNestedMethodState(Variables variables)
14002
bool hasVariableCore(ref
LocalState
state, int id, int index)
14020
static bool hasValue(ref
LocalState
state, int slot)
14030
static bool hasValueCore(ref
LocalState
state, int id, int index)
14159
internal
LocalState
GetStateForVariables(int id)
14161
var
state = this;
14173
public
LocalState
Clone()
14179
public bool Join(in
LocalState
other)
14208
public bool Meet(in
LocalState
other)
14299
public
LocalState
StartingState;
14301
public LocalFunctionState(
LocalState
unreachableState)
14313
return new LocalFunctionState(
LocalState
.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
208
internal void TakeIncrementalSnapshot(BoundNode? node,
LocalState
currentState)
FlowAnalysis\NullableWalker_Patterns.cs (21)
38
var
currentState = State;
275
protected override
LocalState
VisitSwitchStatementDispatch(BoundSwitchStatement node)
313
var
afterSwitchState = labelStateMap.TryGetValue(node.BreakLabel, out var stateAndReachable) ? stateAndReachable.state : UnreachableState();
341
public
LocalState
State;
342
public
LocalState
StateWhenTrue;
343
public
LocalState
StateWhenFalse;
346
public PossiblyConditionalState(
LocalState
stateWhenTrue,
LocalState
stateWhenFalse)
354
public PossiblyConditionalState(
LocalState
state)
376
private PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> LearnFromDecisionDag(
419
var labelStateMap = PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)>.GetInstance();
840
void learnFromNonNullTest(int inputSlot, ref
LocalState
state)
915
void gotoNode(BoundDecisionDagNode node,
LocalState
state, bool believedReachable)
995
var
endState = UnreachableState();
1089
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1103
var
armState = getStateForArm(arm, labelStateMap);
1134
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1146
LocalState
getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap)
1163
var
trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState();
1164
var
falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();