5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
13976
return new
LocalState
(snapshot.Id, container, snapshot.State.Clone());
14005
return new
LocalState
(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true));
14028
return new
LocalState
(variables.Id, container, CreateBitVector(reachable));
14034
return new
LocalState
(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true));
14234
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>)"/>.
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)
2861
private void SetStateAndTrackForFinally(ref
LocalState
state, int slot, NullableFlowState newState)
2867
var
tryState = NonMonotonicState.Value;
2876
protected override void JoinTryBlockState(ref
LocalState
self, ref
LocalState
other)
2878
var
tryState = other.GetStateForVariables(self.Id);
2972
protected override
LocalState
TopState()
2974
var
state =
LocalState
.ReachableState(_variables);
2979
protected override
LocalState
UnreachableState()
2981
return
LocalState
.UnreachableState(_variables);
2984
protected override
LocalState
ReachableBottomState()
2987
return
LocalState
.ReachableStateWithNotNulls(_variables);
3020
var
parameterDefaultsNotAssignedState = State.Clone();
3145
var
joinedState = this.StateWhenTrue.Clone();
3376
var
state = TopState();
3402
var
startingState = localFunctionState.StartingState;
3445
LocalState
state,
3471
var
oldState = this.State;
3548
void enforceMemberNotNull(SyntaxNode? syntax,
LocalState
state)
3575
var
state = State.GetStateForVariables(localFunctionState.StartingState.Id);
3716
var
currentState = State;
4941
private void SetNotNullResultForLambda(BoundExpression node,
LocalState
stateForLambda)
5441
var
stateAfterLeft = this.State;
5444
var
stateWhenNotNull = this.State;
5500
LocalState
getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull)
5502
LocalState
stateWhenNotNull;
5538
var
stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull);
5871
ref
LocalState
stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse;
5877
protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref
LocalState
shortCircuitState)
5982
private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref
LocalState
stateToUpdate)
5990
private void LearnFromNonNullTest(BoundExpression expression, ref
LocalState
state)
6013
private void LearnFromNonNullTest(int slot, ref
LocalState
state)
6018
private void LearnFromNullTest(BoundExpression expression, ref
LocalState
state)
6036
private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref
LocalState
state, bool markDependentSlotsNotNull)
6056
private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref
LocalState
state, int depth = 2)
6137
var
leftState = this.State.Clone();
6358
var
savedState = this.State.Clone();
6467
var
consequenceState = this.StateWhenTrue;
6468
var
alternativeState = this.StateWhenFalse;
6593
BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative,
LocalState
consequenceState,
LocalState
alternativeState,
6640
LocalState
consequenceState,
6641
LocalState
alternativeState,
6661
(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(
LocalState
state, BoundExpression operand)
6674
(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(
LocalState
state, BoundExpression operand)
6697
LocalState
state,
8025
void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref
LocalState
state)
8038
void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref
LocalState
state)
8066
LocalState
markMemberAsNotNull(int receiverSlot, ref
LocalState
state, Symbol member)
8470
var
originalWhenFalse = StateWhenFalse.Clone();
8476
var
newWhenTrue = State.Clone();
8657
private static VariableState GetVariableState(Variables variables,
LocalState
localState)
9385
var
savedState = this.State.Clone();
9826
Optional<
LocalState
> stateForLambda = default,
11143
var
stateForLambda = this.State.Clone();
11155
private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<
LocalState
> initialState = default)
13003
var
leftTrue = this.StateWhenTrue;
13004
var
leftFalse = this.StateWhenFalse;
13020
var
leftTrue = this.StateWhenTrue;
13021
var
leftFalse = this.StateWhenFalse;
13033
var
rightState = State.Clone();
13050
var
leftState = isAnd ? leftFalse : leftTrue;
13087
protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref
LocalState
leftTrue, ref
LocalState
leftFalse)
13180
LocalState
stateWhenNotNull;
13842
protected override string Dump(
LocalState
state)
13847
protected override bool Meet(ref
LocalState
self, ref
LocalState
other)
13864
protected override bool Join(ref
LocalState
self, ref
LocalState
other)
13901
private
LocalState
CloneAndUnsplit(ref PossiblyConditionalState conditionalState)
13908
var
state = conditionalState.StateWhenTrue.Clone();
13950
internal
LocalState
Value;
13952
internal Boxed(
LocalState
value)
13973
internal static
LocalState
Create(LocalStateSnapshot snapshot)
13988
public static
LocalState
ReachableState(Variables variables)
13993
public static
LocalState
UnreachableState(Variables variables)
13998
public static
LocalState
ReachableStateWithNotNulls(Variables variables)
14022
private static
LocalState
CreateReachableOrUnreachableState(Variables variables, bool reachable)
14031
public
LocalState
CreateNestedMethodState(Variables variables)
14060
bool hasVariableCore(ref
LocalState
state, int id, int index)
14078
static bool hasValue(ref
LocalState
state, int slot)
14088
static bool hasValueCore(ref
LocalState
state, int id, int index)
14217
internal
LocalState
GetStateForVariables(int id)
14219
var
state = this;
14231
public
LocalState
Clone()
14237
public bool Join(in
LocalState
other)
14266
public bool Meet(in
LocalState
other)
14357
public
LocalState
StartingState;
14359
public LocalFunctionState(
LocalState
unreachableState)
14371
return new LocalFunctionState(
LocalState
.UnreachableState(variables));
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
208
internal void TakeIncrementalSnapshot(BoundNode? node,
LocalState
currentState)