5 instantiations of LocalState
Microsoft.CodeAnalysis.CSharp (5)
FlowAnalysis\NullableWalker.cs (5)
13212
return new
LocalState
(snapshot.Id, container, snapshot.State.Clone());
13241
return new
LocalState
(variables.Id, container, createBitVectorWithNotNulls(capacity, reachable: true));
13264
return new
LocalState
(variables.Id, container, CreateBitVector(reachable));
13270
return new
LocalState
(variables.Id, container: new Boxed(this), CreateBitVector(reachable: true));
13470
return new
LocalState
(Id, container, _state.Clone());
140 references to LocalState
Microsoft.CodeAnalysis.CSharp (140)
FlowAnalysis\NullableWalker.cs (118)
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, Location, ArrayBuilder<VisitResult>)"/>.
661
void enforceMemberNotNull(SyntaxNode? syntaxOpt,
LocalState
state)
740
void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member,
LocalState
state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
1077
private void EnforceMemberNotNullOnMember(SyntaxNode? syntaxOpt,
LocalState
state, MethodSymbol method, string memberName)
1127
void enforceMemberNotNullWhenIfAffected(SyntaxNode? syntaxOpt, bool sense, ImmutableArray<Symbol> members,
LocalState
state,
LocalState
otherState)
1139
void enforceMemberNotNullWhen(SyntaxNode? syntaxOpt, bool sense,
LocalState
state)
1155
private void ReportFailedMemberNotNullIfNeeded(SyntaxNode? syntaxOpt, bool sense, Symbol member,
LocalState
state)
1164
private bool FailsMemberNotNullExpectation(Symbol member,
LocalState
state)
1295
private void EnforceParameterNotNullOnExit(SyntaxNode? syntaxOpt,
LocalState
state)
1341
private void EnforceParameterNotNullWhenOnExit(SyntaxNode syntax, ImmutableArray<ParameterSymbol> parameters, bool sense,
LocalState
stateWhen)
1354
private void ReportParameterIfBadConditionalState(SyntaxNode syntax, ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1363
bool parameterHasBadConditionalState(ParameterSymbol parameter, bool sense,
LocalState
stateWhen)
1401
private void EnforceNotNullIfNotNull(SyntaxNode? syntaxOpt,
LocalState
state, ImmutableArray<ParameterSymbol> parameters, ImmutableHashSet<string> inputParamNames, NullableFlowState outputState, ParameterSymbol? outputParam)
1704
Analyze(walker, symbol, diagnostics: null,
LocalState
.Create(localState), snapshotBuilderOpt: newSnapshotBuilder);
1825
var
localState =
LocalState
.Create(initialState.VariableNullableStates).CreateNestedMethodState(variables);
1878
Analyze(walker, symbol, diagnostics, initialState is null ? (Optional<
LocalState
>)default :
LocalState
.Create(initialState.VariableNullableStates), snapshotBuilderOpt, requiresAnalysis);
1895
Optional<
LocalState
> initialState,
1989
private NullableFlowState GetState(ref
LocalState
state, int slot)
1998
private void SetState(ref
LocalState
state, int slot, NullableFlowState value, bool useNotNullsAsDefault = false)
2007
private void NormalizeIfNeeded(ref
LocalState
state, int slot, bool useNotNullsAsDefault)
2012
protected override void Normalize(ref
LocalState
state)
2020
private NullableFlowState GetDefaultState(ref
LocalState
state, int slot)
2828
private void SetStateAndTrackForFinally(ref
LocalState
state, int slot, NullableFlowState newState)
2834
var
tryState = NonMonotonicState.Value;
2843
protected override void JoinTryBlockState(ref
LocalState
self, ref
LocalState
other)
2845
var
tryState = other.GetStateForVariables(self.Id);
2939
protected override
LocalState
TopState()
2941
var
state =
LocalState
.ReachableState(_variables);
2946
protected override
LocalState
UnreachableState()
2948
return
LocalState
.UnreachableState(_variables);
2951
protected override
LocalState
ReachableBottomState()
2954
return
LocalState
.ReachableStateWithNotNulls(_variables);
2987
var
parameterDefaultsNotAssignedState = State.Clone();
3112
var
joinedState = this.StateWhenTrue.Clone();
3343
var
state = TopState();
3369
var
startingState = localFunctionState.StartingState;
3412
LocalState
state,
3438
var
oldState = this.State;
3515
void enforceMemberNotNull(SyntaxNode? syntax,
LocalState
state)
3542
var
state = State.GetStateForVariables(localFunctionState.StartingState.Id);
3656
var
currentState = State;
4687
private void SetNotNullResultForLambda(BoundExpression node,
LocalState
stateForLambda)
5187
var
stateAfterLeft = this.State;
5190
var
stateWhenNotNull = this.State;
5246
LocalState
getUnconditionalStateWhenNotNull(BoundExpression otherOperand, PossiblyConditionalState conditionalStateWhenNotNull)
5248
LocalState
stateWhenNotNull;
5284
var
stateWhenNotNull = getUnconditionalStateWhenNotNull(leftOperand, conditionalStateWhenNotNull);
5617
ref
LocalState
stateToUpdate = ref whenTrue ? ref this.StateWhenTrue : ref this.StateWhenFalse;
5623
protected override bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref
LocalState
shortCircuitState)
5728
private void MarkSlotsAsNotNull(ArrayBuilder<int> slots, ref
LocalState
stateToUpdate)
5736
private void LearnFromNonNullTest(BoundExpression expression, ref
LocalState
state)
5759
private void LearnFromNonNullTest(int slot, ref
LocalState
state)
5764
private void LearnFromNullTest(BoundExpression expression, ref
LocalState
state)
5782
private void LearnFromNullTest(int slot, TypeSymbol? expressionType, ref
LocalState
state, bool markDependentSlotsNotNull)
5802
private void MarkDependentSlotsNotNull(int slot, TypeSymbol expressionType, ref
LocalState
state, int depth = 2)
5883
var
leftState = this.State.Clone();
6102
var
savedState = this.State.Clone();
6211
var
consequenceState = this.StateWhenTrue;
6212
var
alternativeState = this.StateWhenFalse;
6337
BoundExpression node, BoundExpression originalConsequence, BoundExpression originalAlternative,
LocalState
consequenceState,
LocalState
alternativeState,
6384
LocalState
consequenceState,
6385
LocalState
alternativeState,
6405
(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(
LocalState
state, BoundExpression operand)
6418
(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(
LocalState
state, BoundExpression operand)
6441
LocalState
state,
7721
void applyMemberPostConditions(int receiverSlot, TypeSymbol type, ImmutableArray<string> members, ref
LocalState
state)
7734
void markMembersAsNotNull(int receiverSlot, TypeSymbol type, string memberName, ref
LocalState
state)
8158
var
originalWhenFalse = StateWhenFalse.Clone();
8164
var
newWhenTrue = State.Clone();
8326
private static VariableState GetVariableState(Variables variables,
LocalState
localState)
9043
var
savedState = this.State.Clone();
9426
Optional<
LocalState
> stateForLambda = default,
10507
var
stateForLambda = this.State.Clone();
10519
private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<
LocalState
> initialState = default)
12289
var
leftTrue = this.StateWhenTrue;
12290
var
leftFalse = this.StateWhenFalse;
12306
var
leftTrue = this.StateWhenTrue;
12307
var
leftFalse = this.StateWhenFalse;
12319
var
rightState = State.Clone();
12336
var
leftState = isAnd ? leftFalse : leftTrue;
12373
protected override void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression node, BoundExpression right, bool isAnd, bool isBool, ref
LocalState
leftTrue, ref
LocalState
leftFalse)
12468
LocalState
stateWhenNotNull;
13078
protected override string Dump(
LocalState
state)
13083
protected override bool Meet(ref
LocalState
self, ref
LocalState
other)
13100
protected override bool Join(ref
LocalState
self, ref
LocalState
other)
13137
private
LocalState
CloneAndUnsplit(ref PossiblyConditionalState conditionalState)
13144
var
state = conditionalState.StateWhenTrue.Clone();
13186
internal
LocalState
Value;
13188
internal Boxed(
LocalState
value)
13209
internal static
LocalState
Create(LocalStateSnapshot snapshot)
13224
public static
LocalState
ReachableState(Variables variables)
13229
public static
LocalState
UnreachableState(Variables variables)
13234
public static
LocalState
ReachableStateWithNotNulls(Variables variables)
13258
private static
LocalState
CreateReachableOrUnreachableState(Variables variables, bool reachable)
13267
public
LocalState
CreateNestedMethodState(Variables variables)
13296
bool hasVariableCore(ref
LocalState
state, int id, int index)
13314
static bool hasValue(ref
LocalState
state, int slot)
13324
static bool hasValueCore(ref
LocalState
state, int id, int index)
13453
internal
LocalState
GetStateForVariables(int id)
13455
var
state = this;
13467
public
LocalState
Clone()
13473
public bool Join(in
LocalState
other)
13502
public bool Meet(in
LocalState
other)
13593
public
LocalState
StartingState;
13595
public LocalFunctionState(
LocalState
unreachableState)
13607
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();