5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
13073
return new
LocalState
(snapshot.Id, container, snapshot.State.Clone());
13102
return new
LocalState
(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true));
13125
return new
LocalState
(variables.Id, container, CreateBitVector(reachable));
13131
return new
LocalState
(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true));
13331
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>)"/>.
642
void enforceMemberNotNull(SyntaxNode? syntaxOpt,
LocalState
state)
723
void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member,
LocalState
state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
1060
private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt,
LocalState
state, MethodSymbol method, string memberName)
1110
void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members,
LocalState
state,
LocalState
otherState)
1122
void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense,
LocalState
state)
1138
private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member,
LocalState
state)
1147
private bool FailsMemberNotNullExpectation(Symbol member,
LocalState
state)
1278
private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt,
LocalState
state)
1324
private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense,
LocalState
stateWhen)
1337
private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1346
bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1384
private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt,
LocalState
state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam)
1687
Analyze(walker, symbol, diagnostics: null,
LocalState
.Create(localState), snapshotBuilderOpt: newSnapshotBuilder);
1807
var
localState =
LocalState
.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables);
1860
Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<
LocalState
>)default :
LocalState
.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis);
1877
Optional<
LocalState
> initialState,
1971
private NullableFlowState GetState(ref
LocalState
state, int slot)
1980
private void SetState(ref
LocalState
state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false)
1989
private void NormalizeIfNeeded(ref
LocalState
state, int slot, bool useNotNullsAsDefault)
1994
protected override void Normalize(ref
LocalState
state)
2002
private NullableFlowState GetDefaultState(ref
LocalState
state, int slot)
2810
private void SetStateAndTrackForFinally(ref
LocalState
state, int slot, NullableFlowState newState)
2816
var
tryState = NonMonotonicState.Value;
2825
protected override void JoinTryBlockState(ref
LocalState
self, ref
LocalState
other)
2827
var
tryState = other.GetStateForVariables(self.Id);
2921
protected override
LocalState
TopState()
2923
var
state =
LocalState
.ReachableState(_variables);
2928
protected override
LocalState
UnreachableState()
2930
return
LocalState
.UnreachableState(_variables);
2933
protected override
LocalState
ReachableBottomState()
2936
return
LocalState
.ReachableStateWithNotNulls(_variables);
2969
var
parameterDefaultsNotAssignedState = State.Clone();
3094
var
joinedState = this.StateWhenTrue.Clone();
3326
var
state = TopState();
3352
var
startingState = localFunctionState.StartingState;
3395
LocalState
state,
3421
var
oldState = this.State;
3498
void enforceMemberNotNull(SyntaxNode? syntax,
LocalState
state)
3525
var
state = State.GetStateForVariables(localFunctionState.StartingState.Id);
3641
var
currentState = State;
4636
private void SetNotNullResultForLambda(BoundExpression node,
LocalState
stateForLambda)
5136
var
stateAfterLeft = this.State;
5139
var
stateWhenNotNull = this.State;
5195
LocalState
getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull)
5197
LocalState
stateWhenNotNull;
5233
var
stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull);
5566
ref
LocalState
stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse;
5572
protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref
LocalState
shortCircuitState)
5677
private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref
LocalState
stateToUpdate)
5685
private void LearnFromNonNullTest(BoundExpression expression, ref
LocalState
state)
5708
private void LearnFromNonNullTest(int slot, ref
LocalState
state)
5713
private void LearnFromNullTest(BoundExpression expression, ref
LocalState
state)
5731
private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref
LocalState
state, bool markDependentSlotsNotNull)
5751
private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref
LocalState
state, int depth = 2)
5832
var
leftState = this.State.Clone();
6051
var
savedState = this.State.Clone();
6160
var
consequenceState = this.StateWhenTrue;
6161
var
alternativeState = this.StateWhenFalse;
6286
BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative,
LocalState
consequenceState,
LocalState
alternativeState,
6333
LocalState
consequenceState,
6334
LocalState
alternativeState,
6354
(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(
LocalState
state, BoundExpression operand)
6367
(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(
LocalState
state, BoundExpression operand)
6390
LocalState
state,
7629
void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref
LocalState
state)
7642
void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref
LocalState
state)
8066
var
originalWhenFalse = StateWhenFalse.Clone();
8072
var
newWhenTrue = State.Clone();
8234
private static VariableState GetVariableState(Variables variables,
LocalState
localState)
8905
var
savedState = this.State.Clone();
9288
Optional<
LocalState
> stateForLambda = default,
10370
var
stateForLambda = this.State.Clone();
10382
private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<
LocalState
> initialState = default)
12152
var
leftTrue = this.StateWhenTrue;
12153
var
leftFalse = this.StateWhenFalse;
12169
var
leftTrue = this.StateWhenTrue;
12170
var
leftFalse = this.StateWhenFalse;
12182
var
rightState = State.Clone();
12199
var
leftState = isAnd ? leftFalse : leftTrue;
12236
protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref
LocalState
leftTrue, ref
LocalState
leftFalse)
12331
LocalState
stateWhenNotNull;
12823
protected override void VisitCatchBlock(BoundCatchBlock node, ref
LocalState
finallyState)
12939
protected override string Dump(
LocalState
state)
12944
protected override bool Meet(ref
LocalState
self, ref
LocalState
other)
12961
protected override bool Join(ref
LocalState
self, ref
LocalState
other)
12998
private
LocalState
CloneAndUnsplit(ref PossiblyConditionalState conditionalState)
13005
var
state = conditionalState.StateWhenTrue.Clone();
13047
internal
LocalState
Value;
13049
internal Boxed(
LocalState
value)
13070
internal static
LocalState
Create(LocalStateSnapshot snapshot)
13085
public static
LocalState
ReachableState(Variables variables)
13090
public static
LocalState
UnreachableState(Variables variables)
13095
public static
LocalState
ReachableStateWithNotNulls(Variables variables)
13119
private static
LocalState
CreateReachableOrUnreachableState(Variables variables, bool reachable)
13128
public
LocalState
CreateNestedMethodState(Variables variables)
13157
bool hasVariableCore(ref
LocalState
state, int id, int index)
13175
static bool hasValue(ref
LocalState
state, int slot)
13185
static bool hasValueCore(ref
LocalState
state, int id, int index)
13314
internal
LocalState
GetStateForVariables(int id)
13316
var
state = this;
13328
public
LocalState
Clone()
13334
public bool Join(in
LocalState
other)
13363
public bool Meet(in
LocalState
other)
13454
public
LocalState
StartingState;
13456
public LocalFunctionState(
LocalState
unreachableState)
13468
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();
731
void learnFromNonNullTest(int inputSlot, ref
LocalState
state)
806
void gotoNode(BoundDecisionDagNode node,
LocalState
state, bool believedReachable)
895
var
endState = UnreachableState();
989
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1003
var
armState = getStateForArm(arm, labelStateMap);
1034
PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap,
1046
LocalState
getStateForArm(BoundSwitchExpressionArm arm, PooledDictionary<LabelSymbol, (
LocalState
state, bool believedReachable)> labelStateMap)
1063
var
trueState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenFalseLabel : node.WhenTrueLabel, out var s1) ? s1.state : UnreachableState();
1064
var
falseState = labelStateMap.TryGetValue(node.IsNegated ? node.WhenTrueLabel : node.WhenFalseLabel, out var s2) ? s2.state : UnreachableState();