5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
13049
return new
LocalState
(snapshot.Id, container, snapshot.State.Clone());
13078
return new
LocalState
(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true));
13101
return new
LocalState
(variables.Id, container, CreateBitVector(reachable));
13107
return new
LocalState
(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true));
13307
return new
LocalState
(Id, container, _state.Clone());
141 references to LocalState
Microsoft.CodeAnalysis.CSharp (141)
FlowAnalysis\NullableWalker.cs (119)
27
: LocalDataFlowPass<NullableWalker.
LocalState
, NullableWalker.LocalFunctionState>
104
public readonly Optional<
LocalState
> StateForLambda;
120
public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<
LocalState
> stateForLambda)
253
/// 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, Location, ArrayBuilder<VisitResult>)"/>.
636
void enforceMemberNotNull(SyntaxNode? syntaxOpt,
LocalState
state)
717
void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member,
LocalState
state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
1054
private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt,
LocalState
state, MethodSymbol method, string memberName)
1104
void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members,
LocalState
state,
LocalState
otherState)
1116
void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense,
LocalState
state)
1132
private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member,
LocalState
state)
1141
private bool FailsMemberNotNullExpectation(Symbol member,
LocalState
state)
1272
private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt,
LocalState
state)
1318
private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense,
LocalState
stateWhen)
1331
private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1340
bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1378
private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt,
LocalState
state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam)
1681
Analyze(walker, symbol, diagnostics: null,
LocalState
.Create(localState), snapshotBuilderOpt: newSnapshotBuilder);
1801
var
localState =
LocalState
.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables);
1854
Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<
LocalState
>)default :
LocalState
.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis);
1871
Optional<
LocalState
> initialState,
1965
private NullableFlowState GetState(ref
LocalState
state, int slot)
1974
private void SetState(ref
LocalState
state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false)
1983
private void NormalizeIfNeeded(ref
LocalState
state, int slot, bool useNotNullsAsDefault)
1988
protected override void Normalize(ref
LocalState
state)
1996
private NullableFlowState GetDefaultState(ref
LocalState
state, int slot)
2804
private void SetStateAndTrackForFinally(ref
LocalState
state, int slot, NullableFlowState newState)
2810
var
tryState = NonMonotonicState.Value;
2819
protected override void JoinTryBlockState(ref
LocalState
self, ref
LocalState
other)
2821
var
tryState = other.GetStateForVariables(self.Id);
2915
protected override
LocalState
TopState()
2917
var
state =
LocalState
.ReachableState(_variables);
2922
protected override
LocalState
UnreachableState()
2924
return
LocalState
.UnreachableState(_variables);
2927
protected override
LocalState
ReachableBottomState()
2930
return
LocalState
.ReachableStateWithNotNulls(_variables);
2963
var
parameterDefaultsNotAssignedState = State.Clone();
3088
var
joinedState = this.StateWhenTrue.Clone();
3320
var
state = TopState();
3346
var
startingState = localFunctionState.StartingState;
3389
LocalState
state,
3415
var
oldState = this.State;
3492
void enforceMemberNotNull(SyntaxNode? syntax,
LocalState
state)
3519
var
state = State.GetStateForVariables(localFunctionState.StartingState.Id);
3635
var
currentState = State;
4629
private void SetNotNullResultForLambda(BoundExpression node,
LocalState
stateForLambda)
5129
var
stateAfterLeft = this.State;
5132
var
stateWhenNotNull = this.State;
5188
LocalState
getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull)
5190
LocalState
stateWhenNotNull;
5226
var
stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull);
5559
ref
LocalState
stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse;
5565
protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref
LocalState
shortCircuitState)
5670
private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref
LocalState
stateToUpdate)
5678
private void LearnFromNonNullTest(BoundExpression expression, ref
LocalState
state)
5701
private void LearnFromNonNullTest(int slot, ref
LocalState
state)
5706
private void LearnFromNullTest(BoundExpression expression, ref
LocalState
state)
5724
private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref
LocalState
state, bool markDependentSlotsNotNull)
5744
private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref
LocalState
state, int depth = 2)
5825
var
leftState = this.State.Clone();
6044
var
savedState = this.State.Clone();
6153
var
consequenceState = this.StateWhenTrue;
6154
var
alternativeState = this.StateWhenFalse;
6279
BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative,
LocalState
consequenceState,
LocalState
alternativeState,
6326
LocalState
consequenceState,
6327
LocalState
alternativeState,
6347
(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(
LocalState
state, BoundExpression operand)
6360
(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(
LocalState
state, BoundExpression operand)
6383
LocalState
state,
7626
void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref
LocalState
state)
7639
void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref
LocalState
state)
8063
var
originalWhenFalse = StateWhenFalse.Clone();
8069
var
newWhenTrue = State.Clone();
8231
private static VariableState GetVariableState(Variables variables,
LocalState
localState)
8901
var
savedState = this.State.Clone();
9284
Optional<
LocalState
> stateForLambda = default,
10358
var
stateForLambda = this.State.Clone();
10370
private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<
LocalState
> initialState = default)
12128
var
leftTrue = this.StateWhenTrue;
12129
var
leftFalse = this.StateWhenFalse;
12145
var
leftTrue = this.StateWhenTrue;
12146
var
leftFalse = this.StateWhenFalse;
12158
var
rightState = State.Clone();
12175
var
leftState = isAnd ? leftFalse : leftTrue;
12212
protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref
LocalState
leftTrue, ref
LocalState
leftFalse)
12307
LocalState
stateWhenNotNull;
12799
protected override void VisitCatchBlock(BoundCatchBlock node, ref
LocalState
finallyState)
12915
protected override string Dump(
LocalState
state)
12920
protected override bool Meet(ref
LocalState
self, ref
LocalState
other)
12937
protected override bool Join(ref
LocalState
self, ref
LocalState
other)
12974
private
LocalState
CloneAndUnsplit(ref PossiblyConditionalState conditionalState)
12981
var
state = conditionalState.StateWhenTrue.Clone();
13023
internal
LocalState
Value;
13025
internal Boxed(
LocalState
value)
13046
internal static
LocalState
Create(LocalStateSnapshot snapshot)
13061
public static
LocalState
ReachableState(Variables variables)
13066
public static
LocalState
UnreachableState(Variables variables)
13071
public static
LocalState
ReachableStateWithNotNulls(Variables variables)
13095
private static
LocalState
CreateReachableOrUnreachableState(Variables variables, bool reachable)
13104
public
LocalState
CreateNestedMethodState(Variables variables)
13133
bool hasVariableCore(ref
LocalState
state, int id, int index)
13151
static bool hasValue(ref
LocalState
state, int slot)
13161
static bool hasValueCore(ref
LocalState
state, int id, int index)
13290
internal
LocalState
GetStateForVariables(int id)
13292
var
state = this;
13304
public
LocalState
Clone()
13310
public bool Join(in
LocalState
other)
13339
public bool Meet(in
LocalState
other)
13430
public
LocalState
StartingState;
13432
public LocalFunctionState(
LocalState
unreachableState)
13444
return new LocalFunctionState(
LocalState
.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
208
internal void TakeIncrementalSnapshot(BoundNode? node,
LocalState
currentState)
FlowAnalysis\NullableWalker_Patterns.cs (21)
37
var
currentState = State;
273
protected override
LocalState
VisitSwitchStatementDispatch(BoundSwitchStatement node)
311
var
afterSwitchState = labelStateMap.TryGetValue(node.BreakLabel, out var stateAndReachable) ? stateAndReachable.state : UnreachableState();
339
public
LocalState
State;
340
public
LocalState
StateWhenTrue;
341
public
LocalState
StateWhenFalse;
344
public PossiblyConditionalState(
LocalState
stateWhenTrue,
LocalState
stateWhenFalse)
352
public PossiblyConditionalState(
LocalState
state)
374
private PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> LearnFromDecisionDag(
416
var labelStateMap = PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)>.GetInstance();
729
void learnFromNonNullTest(int inputSlot, ref
LocalState
state)
804
void gotoNode(BoundDecisionDagNode node,
LocalState
state, bool believedReachable)
893
var
endState = UnreachableState();
987
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1001
var
armState = getStateForArm(arm, labelStateMap);
1032
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1044
LocalState
getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap)
1061
var
trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState();
1062
var
falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();