5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
11337
return new
LocalState
(snapshot.Id, container, snapshot.State.Clone());
11366
return new
LocalState
(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true));
11389
return new
LocalState
(variables.Id, container, CreateBitVector(reachable));
11395
return new
LocalState
(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true));
11591
return new
LocalState
(Id, container, _state.Clone());
135 references to LocalState
Microsoft.CodeAnalysis.CSharp (135)
FlowAnalysis\NullableWalker.cs (113)
27
: LocalDataFlowPass<NullableWalker.
LocalState
, NullableWalker.LocalFunctionState>
123
/// In addition to storing the <see cref="VisitResult"/>, also stores the <see cref="
LocalState
"/>
130
public readonly Optional<
LocalState
> StateForLambda;
135
public VisitArgumentResult(VisitResult visitResult, Optional<
LocalState
> stateForLambda)
224
/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, Optional<
LocalState
>,bool, Location, ArrayBuilder<VisitResult>)"/>.
589
void enforceMemberNotNull(SyntaxNode? syntaxOpt,
LocalState
state)
671
void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member,
LocalState
state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
758
void enforceMemberNotNullOnMember(SyntaxNode? syntaxOpt,
LocalState
state, MethodSymbol method, string memberName)
804
void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members,
LocalState
state,
LocalState
otherState)
816
void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense,
LocalState
state)
831
void reportMemberIfBadConditionalState(SyntaxNode? syntaxOpt, bool sense, Symbol member,
LocalState
state)
840
bool memberHasBadState(Symbol member,
LocalState
state)
1143
private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt,
LocalState
state)
1183
private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense,
LocalState
stateWhen)
1196
private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1205
bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1243
private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt,
LocalState
state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam)
1543
Analyze(walker, symbol, diagnostics: null,
LocalState
.Create(localState), snapshotBuilderOpt: newSnapshotBuilder);
1660
var
localState =
LocalState
.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables);
1708
Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<
LocalState
>)default :
LocalState
.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis);
1725
Optional<
LocalState
> initialState,
1819
private NullableFlowState GetState(ref
LocalState
state, int slot)
1828
private void SetState(ref
LocalState
state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false)
1837
private void NormalizeIfNeeded(ref
LocalState
state, int slot, bool useNotNullsAsDefault)
1842
protected override void Normalize(ref
LocalState
state)
1850
private NullableFlowState GetDefaultState(ref
LocalState
state, int slot)
2620
private void SetStateAndTrackForFinally(ref
LocalState
state, int slot, NullableFlowState newState)
2626
var
tryState = NonMonotonicState.Value;
2635
protected override void JoinTryBlockState(ref
LocalState
self, ref
LocalState
other)
2637
var
tryState = other.GetStateForVariables(self.Id);
2677
protected override
LocalState
TopState()
2679
var
state =
LocalState
.ReachableState(_variables);
2684
protected override
LocalState
UnreachableState()
2686
return
LocalState
.UnreachableState(_variables);
2689
protected override
LocalState
ReachableBottomState()
2692
return
LocalState
.ReachableStateWithNotNulls(_variables);
2728
var
parameterDefaultsNotAssignedState = State.Clone();
2853
var
joinedState = this.StateWhenTrue.Clone();
3024
var
state = TopState();
3025
var
startingState = localFunctionState.StartingState;
3066
LocalState
state,
3092
var
oldState = this.State;
3162
var
state = State.GetStateForVariables(localFunctionState.StartingState.Id);
3278
var
currentState = State;
4485
var
stateAfterLeft = this.State;
4488
var
stateWhenNotNull = this.State;
4544
LocalState
getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull)
4546
LocalState
stateWhenNotNull;
4582
var
stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull);
4839
ref
LocalState
stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse;
4845
protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref
LocalState
shortCircuitState)
4950
private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref
LocalState
stateToUpdate)
4958
private void LearnFromNonNullTest(BoundExpression expression, ref
LocalState
state)
4981
private void LearnFromNonNullTest(int slot, ref
LocalState
state)
4986
private void LearnFromNullTest(BoundExpression expression, ref
LocalState
state)
5004
private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref
LocalState
state, bool markDependentSlotsNotNull)
5024
private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref
LocalState
state, int depth = 2)
5105
var
leftState = this.State.Clone();
5308
var
savedState = this.State.Clone();
5417
var
consequenceState = this.StateWhenTrue;
5418
var
alternativeState = this.StateWhenFalse;
5518
BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative,
LocalState
consequenceState,
LocalState
alternativeState,
5565
LocalState
consequenceState,
5566
LocalState
alternativeState,
5586
(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(
LocalState
state, BoundExpression operand)
5599
(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(
LocalState
state, BoundExpression operand)
5614
LocalState
state,
6413
void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref
LocalState
state)
6426
void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref
LocalState
state)
6497
var savedState = (argument.Kind == BoundKind.Lambda) ? this.State.Clone() : default(Optional<
LocalState
>);
6813
var
originalWhenFalse = StateWhenFalse.Clone();
6819
var
newWhenTrue = State.Clone();
6980
private static VariableState GetVariableState(Variables variables,
LocalState
localState)
7143
BoundExpression getArgumentForMethodTypeInference(BoundExpression argument, TypeWithAnnotations argumentType, Optional<
LocalState
> lambdaState)
7558
var
savedState = this.State.Clone();
7921
Optional<
LocalState
> stateForLambda = default,
8966
private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<
LocalState
> initialState = default)
10434
protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref
LocalState
leftTrue, ref
LocalState
leftFalse)
10595
LocalState
stateWhenNotNull;
11087
protected override void VisitCatchBlock(BoundCatchBlock node, ref
LocalState
finallyState)
11203
protected override string Dump(
LocalState
state)
11208
protected override bool Meet(ref
LocalState
self, ref
LocalState
other)
11225
protected override bool Join(ref
LocalState
self, ref
LocalState
other)
11262
private
LocalState
CloneAndUnsplit(ref PossiblyConditionalState conditionalState)
11269
var
state = conditionalState.StateWhenTrue.Clone();
11311
internal
LocalState
Value;
11313
internal Boxed(
LocalState
value)
11334
internal static
LocalState
Create(LocalStateSnapshot snapshot)
11349
public static
LocalState
ReachableState(Variables variables)
11354
public static
LocalState
UnreachableState(Variables variables)
11359
public static
LocalState
ReachableStateWithNotNulls(Variables variables)
11383
private static
LocalState
CreateReachableOrUnreachableState(Variables variables, bool reachable)
11392
public
LocalState
CreateNestedMethodState(Variables variables)
11421
bool hasVariableCore(ref
LocalState
state, int id, int index)
11439
static bool hasValue(ref
LocalState
state, int slot)
11449
static bool hasValueCore(ref
LocalState
state, int id, int index)
11574
internal
LocalState
GetStateForVariables(int id)
11576
var
state = this;
11588
public
LocalState
Clone()
11594
public bool Join(in
LocalState
other)
11620
public bool Meet(in
LocalState
other)
11711
public
LocalState
StartingState;
11712
public LocalFunctionState(
LocalState
unreachableState)
11723
return new LocalFunctionState(
LocalState
.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
211
internal void TakeIncrementalSnapshot(BoundNode? node,
LocalState
currentState)
FlowAnalysis\NullableWalker_Patterns.cs (21)
37
var
currentState = State;
235
protected override
LocalState
VisitSwitchStatementDispatch(BoundSwitchStatement node)
273
var
afterSwitchState = labelStateMap.TryGetValue(node.BreakLabel, out var stateAndReachable) ? stateAndReachable.state : UnreachableState();
301
public
LocalState
State;
302
public
LocalState
StateWhenTrue;
303
public
LocalState
StateWhenFalse;
306
public PossiblyConditionalState(
LocalState
stateWhenTrue,
LocalState
stateWhenFalse)
314
public PossiblyConditionalState(
LocalState
state)
336
private PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> LearnFromDecisionDag(
378
var labelStateMap = PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)>.GetInstance();
689
void learnFromNonNullTest(int inputSlot, ref
LocalState
state)
764
void gotoNode(BoundDecisionDagNode node,
LocalState
state, bool believedReachable)
853
var
endState = UnreachableState();
942
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
956
var
armState = getStateForArm(arm, labelStateMap);
987
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
999
LocalState
getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap)
1016
var
trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState();
1017
var
falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();