4 types derived from BoundDecisionDagNode
Microsoft.CodeAnalysis.CSharp (4)
Generated\BoundNodes.xml.Generated.cs (4)
4933
internal sealed partial class BoundEvaluationDecisionDagNode :
BoundDecisionDagNode
4964
internal sealed partial class BoundTestDecisionDagNode :
BoundDecisionDagNode
4998
internal sealed partial class BoundWhenDecisionDagNode :
BoundDecisionDagNode
5033
internal sealed partial class BoundLeafDecisionDagNode :
BoundDecisionDagNode
153 references to BoundDecisionDagNode
Microsoft.CodeAnalysis.CSharp (153)
Binder\DecisionDagBuilder.cs (16)
24
/// sequence of binary tests. Each node is represented by a <see cref="
BoundDecisionDagNode
"/>. There are four
50
/// <see cref="
BoundDecisionDagNode
"/> for each of them, containing
721
var
rootDecisionDagNode = decisionDag.RootNode.Dag;
733
var
node = sortedBoundDagNodes[i];
948
var uniqueNodes = PooledDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
>.GetInstance();
949
BoundDecisionDagNode
uniqifyDagNode(
BoundDecisionDagNode
node) => uniqueNodes.GetOrAdd(node, node);
977
BoundDecisionDagNode
whenTrue = finalState(first.Syntax, first.CaseLabel, default);
978
BoundDecisionDagNode
? whenFalse = state.FalseBranch.Dag;
984
BoundDecisionDagNode
finalState(SyntaxNode syntax, LabelSymbol label, ImmutableArray<BoundPatternBinding> bindings)
986
BoundDecisionDagNode
final = uniqifyDagNode(new BoundLeafDecisionDagNode(syntax, label));
996
BoundDecisionDagNode
? next = state.TrueBranch!.Dag;
1004
BoundDecisionDagNode
? whenTrue = state.TrueBranch!.Dag;
1005
BoundDecisionDagNode
? whenFalse = state.FalseBranch!.Dag;
1775
public
BoundDecisionDagNode
? Dag;
Binder\PatternExplainer.cs (23)
31
private static ImmutableArray<
BoundDecisionDagNode
> ShortestPathToNode(
32
ImmutableArray<
BoundDecisionDagNode
> nodes,
33
BoundDecisionDagNode
node,
38
var dist = PooledDictionary<
BoundDecisionDagNode
, (int distance,
BoundDecisionDagNode
next)>.GetInstance();
41
int distance(
BoundDecisionDagNode
x)
53
var
n = nodes[i];
73
var result = ArrayBuilder<
BoundDecisionDagNode
>.GetInstance(capacity: distanceToNode);
74
for (
BoundDecisionDagNode
n = nodes[0]; n != node;)
83
(int d,
BoundDecisionDagNode
next) = dist[t];
110
private static void VisitPathsToNode(
BoundDecisionDagNode
rootNode,
BoundDecisionDagNode
targetNode, bool nullPaths,
111
Func<ImmutableArray<
BoundDecisionDagNode
>, bool, bool> handler)
113
var pathBuilder = ArrayBuilder<
BoundDecisionDagNode
>.GetInstance();
120
bool exploreToNode(
BoundDecisionDagNode
currentNode, bool currentRequiresFalseWhenClause)
181
ImmutableArray<
BoundDecisionDagNode
> nodes,
182
BoundDecisionDagNode
targetNode,
210
static string samplePatternFromOtherPaths(BoundDagTemp rootIdentifier,
BoundDecisionDagNode
rootNode,
211
BoundDecisionDagNode
targetNode, bool nullPaths, out bool requiresFalseWhenClause, out bool unnamedEnumValue)
244
static void gatherConstraintsAndEvaluations(
BoundDecisionDagNode
targetNode, ImmutableArray<
BoundDecisionDagNode
> pathToNode,
252
BoundDecisionDagNode
node = pathToNode[i];
257
BoundDecisionDagNode
nextNode = (i < n - 1) ? pathToNode[i + 1] : targetNode;
Binder\SwitchExpressionBinder.cs (4)
87
bool wasAcyclic = TopologicalSort.TryIterativeSort<
BoundDecisionDagNode
>(SpecializedCollections.SingletonEnumerable(decisionDag.RootNode), nonNullSuccessors, out var nodes);
90
foreach (
var
n in nodes)
110
ImmutableArray<
BoundDecisionDagNode
> nonNullSuccessors(
BoundDecisionDagNode
n)
BoundTree\BoundDecisionDag.cs (30)
21
private ImmutableArray<
BoundDecisionDagNode
> _topologicallySortedNodes;
23
internal static ImmutableArray<
BoundDecisionDagNode
> Successors(
BoundDecisionDagNode
node)
32
return ImmutableArray<
BoundDecisionDagNode
>.Empty;
47
foreach (
var
node in this.TopologicallySortedNodes)
65
public ImmutableArray<
BoundDecisionDagNode
> TopologicallySortedNodes
72
bool wasAcyclic = TopologicalSort.TryIterativeSort<
BoundDecisionDagNode
>(SpecializedCollections.SingletonEnumerable(this.RootNode), Successors, out _topologicallySortedNodes);
87
public BoundDecisionDag Rewrite(Func<
BoundDecisionDagNode
, IReadOnlyDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
>,
BoundDecisionDagNode
> makeReplacement)
92
ImmutableArray<
BoundDecisionDagNode
> sortedNodes = this.TopologicallySortedNodes;
96
var replacement = PooledDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
>.GetInstance();
101
BoundDecisionDagNode
node = sortedNodes[i];
103
BoundDecisionDagNode
newNode = makeReplacement(node, replacement);
108
var
newRoot = replacement[this.RootNode];
114
/// A trivial node replacement function for use with <see cref="Rewrite(Func{
BoundDecisionDagNode
, IReadOnlyDictionary{
BoundDecisionDagNode
,
BoundDecisionDagNode
},
BoundDecisionDagNode
})"/>.
116
public static
BoundDecisionDagNode
TrivialReplacement(
BoundDecisionDagNode
dag, IReadOnlyDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
> replacement)
150
BoundDecisionDagNode
makeReplacement(
BoundDecisionDagNode
dag, IReadOnlyDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
> replacement)
214
foreach (
var
state in allStates)
FlowAnalysis\NullableWalker_Patterns.cs (5)
375
var nodeStateMap = PooledDictionary<
BoundDecisionDagNode
, (PossiblyConditionalState state, bool believedReachable)>.GetInstance();
380
foreach (
var
dagNode in decisionDag.TopologicallySortedNodes)
732
void gotoNodeWithCurrentState(
BoundDecisionDagNode
node, bool believedReachable)
764
void gotoNode(
BoundDecisionDagNode
node, LocalState state, bool believedReachable)
861
var
leaf = nodes.Where(n => n is BoundLeafDecisionDagNode leaf && leaf.Label == node.DefaultLabel).First();
Generated\BoundNodes.xml.Generated.cs (30)
4893
public BoundDecisionDag(SyntaxNode syntax,
BoundDecisionDagNode
rootNode, bool hasErrors = false)
4902
public
BoundDecisionDagNode
RootNode { get; }
4907
public BoundDecisionDag Update(
BoundDecisionDagNode
rootNode)
4935
public BoundEvaluationDecisionDagNode(SyntaxNode syntax, BoundDagEvaluation evaluation,
BoundDecisionDagNode
next, bool hasErrors = false)
4947
public
BoundDecisionDagNode
Next { get; }
4952
public BoundEvaluationDecisionDagNode Update(BoundDagEvaluation evaluation,
BoundDecisionDagNode
next)
4966
public BoundTestDecisionDagNode(SyntaxNode syntax, BoundDagTest test,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
whenFalse, bool hasErrors = false)
4980
public
BoundDecisionDagNode
WhenTrue { get; }
4981
public
BoundDecisionDagNode
WhenFalse { get; }
4986
public BoundTestDecisionDagNode Update(BoundDagTest test,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
whenFalse)
5000
public BoundWhenDecisionDagNode(SyntaxNode syntax, ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
? whenFalse, bool hasErrors = false)
5015
public
BoundDecisionDagNode
WhenTrue { get; }
5016
public
BoundDecisionDagNode
? WhenFalse { get; }
5021
public BoundWhenDecisionDagNode Update(ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
? whenFalse)
11150
BoundDecisionDagNode
rootNode = (
BoundDecisionDagNode
)this.Visit(node.RootNode);
11156
BoundDecisionDagNode
next = (
BoundDecisionDagNode
)this.Visit(node.Next);
11162
BoundDecisionDagNode
whenTrue = (
BoundDecisionDagNode
)this.Visit(node.WhenTrue);
11163
BoundDecisionDagNode
whenFalse = (
BoundDecisionDagNode
)this.Visit(node.WhenFalse);
11169
BoundDecisionDagNode
whenTrue = (
BoundDecisionDagNode
)this.Visit(node.WhenTrue);
11170
BoundDecisionDagNode
? whenFalse = (
BoundDecisionDagNode
?)this.Visit(node.WhenFalse);
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (34)
43
private readonly PooledDictionary<
BoundDecisionDagNode
, LabelSymbol> _dagNodeLabels = PooledDictionary<
BoundDecisionDagNode
, LabelSymbol>.GetInstance();
65
var hasPredecessor = PooledHashSet<
BoundDecisionDagNode
>.GetInstance();
66
foreach (
BoundDecisionDagNode
node in decisionDag.TopologicallySortedNodes)
96
void notePredecessor(
BoundDecisionDagNode
successor)
111
protected virtual LabelSymbol GetDagNodeLabel(
BoundDecisionDagNode
dag)
374
ImmutableArray<
BoundDecisionDagNode
> sortedNodes = decisionDag.TopologicallySortedNodes;
375
var
firstNode = sortedNodes[0];
389
ImmutableArray<
BoundDecisionDagNode
> nodesToLower = sortedNodes.WhereAsArray(n => n.Kind != BoundKind.WhenDecisionDagNode && n.Kind != BoundKind.LeafDecisionDagNode);
390
var loweredNodes = PooledHashSet<
BoundDecisionDagNode
>.GetInstance();
393
BoundDecisionDagNode
node = nodesToLower[i];
419
BoundDecisionDagNode
nextNode = ((i + 1) < length) ? nodesToLower[i + 1] : null;
440
BoundDecisionDagNode
node,
441
HashSet<
BoundDecisionDagNode
> loweredNodes,
442
ImmutableArray<
BoundDecisionDagNode
> nodesToLower,
451
var
whenTrue = evaluationNode.Next;
452
var
whenFalse = testNode.WhenFalse;
458
var
nextNode =
472
private void GenerateTest(BoundExpression test,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
whenFalse,
BoundDecisionDagNode
nextNode)
499
private bool GenerateSwitchDispatch(
BoundDecisionDagNode
node, HashSet<
BoundDecisionDagNode
> loweredNodes)
510
bool canGenerateSwitchDispatch(
BoundDecisionDagNode
node)
551
BoundDecisionDagNode
node,
552
HashSet<
BoundDecisionDagNode
> loweredNodes,
560
BoundDecisionDagNode
node,
561
HashSet<
BoundDecisionDagNode
> loweredNodes,
970
private void LowerWhenClauses(ImmutableArray<
BoundDecisionDagNode
> sortedNodes)
1004
foreach (
BoundDecisionDagNode
node in sortedNodes)
1031
foreach (
BoundDecisionDagNode
node in sortedNodes)
1159
var
whenFalse = whenClause.WhenFalse;
1198
private void LowerDecisionDagNode(
BoundDecisionDagNode
node,
BoundDecisionDagNode
nextNode)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (6)
534
foreach (
BoundDecisionDagNode
node in decisionDag.TopologicallySortedNodes)
578
static bool usesOriginalInput(
BoundDecisionDagNode
node)
655
static
BoundDecisionDagNode
makeReplacement(
BoundDecisionDagNode
node, IReadOnlyDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
> replacement)
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (4)
57
BoundDecisionDagNode
node,
137
private static bool IsFailureNode(
BoundDecisionDagNode
node, LabelSymbol whenFalseLabel)
230
var
node = decisionDag.RootNode;
238
BoundDecisionDagNode
node,
Lowering\LocalRewriter\LocalRewriter_PatternSwitchStatement.cs (1)
40
protected override LabelSymbol GetDagNodeLabel(
BoundDecisionDagNode
dag)