4 types derived from BoundDecisionDagNode
Microsoft.CodeAnalysis.CSharp (4)
Generated\BoundNodes.xml.Generated.cs (4)
5106
internal sealed partial class BoundEvaluationDecisionDagNode :
BoundDecisionDagNode
5137
internal sealed partial class BoundTestDecisionDagNode :
BoundDecisionDagNode
5171
internal sealed partial class BoundWhenDecisionDagNode :
BoundDecisionDagNode
5206
internal sealed partial class BoundLeafDecisionDagNode :
BoundDecisionDagNode
151 references to BoundDecisionDagNode
Microsoft.CodeAnalysis.CSharp (151)
Binder\DecisionDagBuilder.cs (16)
24
/// sequence of binary tests. Each node is represented by a <see cref="
BoundDecisionDagNode
"/>. There are four
45
/// create a new <see cref="
BoundDecisionDagNode
"/> for each of them, containing the state transitions (including
1203
var
rootDecisionDagNode = decisionDag.RootNode.Dag;
1226
var
node = sortedBoundDagNodes[i];
1603
var uniqueNodes = PooledDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
>.GetInstance();
1604
BoundDecisionDagNode
uniqifyDagNode(
BoundDecisionDagNode
node) => uniqueNodes.GetOrAdd(node, node);
1632
BoundDecisionDagNode
whenTrue = finalState(first.Syntax, first.CaseLabel, default);
1633
BoundDecisionDagNode
? whenFalse = state.FalseBranch.Dag;
1639
BoundDecisionDagNode
finalState(SyntaxNode syntax, LabelSymbol label, ImmutableArray<BoundPatternBinding> bindings)
1641
BoundDecisionDagNode
final = uniqifyDagNode(new BoundLeafDecisionDagNode(syntax, label));
1651
BoundDecisionDagNode
? next = state.TrueBranch!.Dag;
1659
BoundDecisionDagNode
? whenTrue = state.TrueBranch!.Dag;
1660
BoundDecisionDagNode
? whenFalse = state.FalseBranch!.Dag;
3022
public
BoundDecisionDagNode
? Dag;
Binder\PatternExplainer.cs (24)
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)
114
var pathBuilder = ArrayBuilder<
BoundDecisionDagNode
>.GetInstance();
115
var stack = ArrayBuilder<
BoundDecisionDagNode
?>.GetInstance();
123
bool exploreToNode(
BoundDecisionDagNode
? currentNode, bool currentRequiresFalseWhenClause)
222
ImmutableArray<
BoundDecisionDagNode
> nodes,
223
BoundDecisionDagNode
targetNode,
251
static string samplePatternFromOtherPaths(Binder binder, BoundDagTemp rootIdentifier,
BoundDecisionDagNode
rootNode,
252
BoundDecisionDagNode
targetNode, bool nullPaths, out bool requiresFalseWhenClause, out bool unnamedEnumValue)
285
static void gatherConstraintsAndEvaluations(Binder binder,
BoundDecisionDagNode
targetNode, ImmutableArray<
BoundDecisionDagNode
> pathToNode,
293
BoundDecisionDagNode
node = pathToNode[i];
298
BoundDecisionDagNode
nextNode = (i < n - 1) ? pathToNode[i + 1] : targetNode;
Binder\SwitchExpressionBinder.cs (3)
101
foreach (
var
n in nodes)
122
static void addNonNullSuccessors(ref TemporaryArray<
BoundDecisionDagNode
> builder,
BoundDecisionDagNode
n)
BoundTree\BoundDecisionDag.cs (28)
22
private ImmutableArray<
BoundDecisionDagNode
> _topologicallySortedNodes;
24
internal static void AddSuccessors(ref TemporaryArray<
BoundDecisionDagNode
> builder,
BoundDecisionDagNode
node)
53
foreach (
var
node in this.TopologicallySortedNodes)
71
public ImmutableArray<
BoundDecisionDagNode
> TopologicallySortedNodes
93
public BoundDecisionDag Rewrite(Func<
BoundDecisionDagNode
, IReadOnlyDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
>,
BoundDecisionDagNode
> makeReplacement)
98
ImmutableArray<
BoundDecisionDagNode
> sortedNodes = this.TopologicallySortedNodes;
102
var replacement = PooledDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
>.GetInstance();
107
BoundDecisionDagNode
node = sortedNodes[i];
109
BoundDecisionDagNode
newNode = makeReplacement(node, replacement);
114
var
newRoot = replacement[this.RootNode];
120
/// A trivial node replacement function for use with <see cref="Rewrite(Func{
BoundDecisionDagNode
, IReadOnlyDictionary{
BoundDecisionDagNode
,
BoundDecisionDagNode
},
BoundDecisionDagNode
})"/>.
122
public static
BoundDecisionDagNode
TrivialReplacement(
BoundDecisionDagNode
dag, IReadOnlyDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
> replacement)
156
BoundDecisionDagNode
makeReplacement(
BoundDecisionDagNode
dag, IReadOnlyDictionary<
BoundDecisionDagNode
,
BoundDecisionDagNode
> replacement)
215
foreach (
var
state in allStates)
FlowAnalysis\NullableWalker_Patterns.cs (5)
416
var nodeStateMap = PooledDictionary<
BoundDecisionDagNode
, (PossiblyConditionalState state, bool believedReachable)>.GetInstance();
421
foreach (
var
dagNode in decisionDag.TopologicallySortedNodes)
883
void gotoNodeWithCurrentState(
BoundDecisionDagNode
node, bool believedReachable)
915
void gotoNode(
BoundDecisionDagNode
node, LocalState state, bool believedReachable)
1003
var
leaf = nodes.Where(n => n is BoundLeafDecisionDagNode leaf && leaf.Label == node.DefaultLabel).First();
Generated\BoundNodes.xml.Generated.cs (30)
5064
public BoundDecisionDag(SyntaxNode syntax,
BoundDecisionDagNode
rootNode, bool suitableForLowering, bool hasErrors = false)
5074
public
BoundDecisionDagNode
RootNode { get; }
5080
public BoundDecisionDag Update(
BoundDecisionDagNode
rootNode, bool suitableForLowering)
5108
public BoundEvaluationDecisionDagNode(SyntaxNode syntax, BoundDagEvaluation evaluation,
BoundDecisionDagNode
next, bool hasErrors = false)
5120
public
BoundDecisionDagNode
Next { get; }
5125
public BoundEvaluationDecisionDagNode Update(BoundDagEvaluation evaluation,
BoundDecisionDagNode
next)
5139
public BoundTestDecisionDagNode(SyntaxNode syntax, BoundDagTest test,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
whenFalse, bool hasErrors = false)
5153
public
BoundDecisionDagNode
WhenTrue { get; }
5154
public
BoundDecisionDagNode
WhenFalse { get; }
5159
public BoundTestDecisionDagNode Update(BoundDagTest test,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
whenFalse)
5173
public BoundWhenDecisionDagNode(SyntaxNode syntax, ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
? whenFalse, bool hasErrors = false)
5188
public
BoundDecisionDagNode
WhenTrue { get; }
5189
public
BoundDecisionDagNode
? WhenFalse { get; }
5194
public BoundWhenDecisionDagNode Update(ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
? whenFalse)
11955
BoundDecisionDagNode
rootNode = (
BoundDecisionDagNode
)this.Visit(node.RootNode);
11961
BoundDecisionDagNode
next = (
BoundDecisionDagNode
)this.Visit(node.Next);
11967
BoundDecisionDagNode
whenTrue = (
BoundDecisionDagNode
)this.Visit(node.WhenTrue);
11968
BoundDecisionDagNode
whenFalse = (
BoundDecisionDagNode
)this.Visit(node.WhenFalse);
11974
BoundDecisionDagNode
whenTrue = (
BoundDecisionDagNode
)this.Visit(node.WhenTrue);
11975
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)
373
ImmutableArray<
BoundDecisionDagNode
> sortedNodes = decisionDag.TopologicallySortedNodes;
374
var
firstNode = sortedNodes[0];
388
ImmutableArray<
BoundDecisionDagNode
> nodesToLower = sortedNodes.WhereAsArray(n => n.Kind != BoundKind.WhenDecisionDagNode && n.Kind != BoundKind.LeafDecisionDagNode);
389
var loweredNodes = PooledHashSet<
BoundDecisionDagNode
>.GetInstance();
392
BoundDecisionDagNode
node = nodesToLower[i];
418
BoundDecisionDagNode
nextNode = ((i + 1) < length) ? nodesToLower[i + 1] : null;
439
BoundDecisionDagNode
node,
440
HashSet<
BoundDecisionDagNode
> loweredNodes,
441
ImmutableArray<
BoundDecisionDagNode
> nodesToLower,
450
var
whenTrue = evaluationNode.Next;
451
var
whenFalse = testNode.WhenFalse;
457
var
nextNode =
471
private void GenerateTest(BoundExpression test,
BoundDecisionDagNode
whenTrue,
BoundDecisionDagNode
whenFalse,
BoundDecisionDagNode
nextNode)
498
private bool GenerateSwitchDispatch(
BoundDecisionDagNode
node, HashSet<
BoundDecisionDagNode
> loweredNodes)
509
bool canGenerateSwitchDispatch(
BoundDecisionDagNode
node)
550
BoundDecisionDagNode
node,
551
HashSet<
BoundDecisionDagNode
> loweredNodes,
559
BoundDecisionDagNode
node,
560
HashSet<
BoundDecisionDagNode
> loweredNodes,
978
private void LowerWhenClauses(ImmutableArray<
BoundDecisionDagNode
> sortedNodes)
1012
foreach (
BoundDecisionDagNode
node in sortedNodes)
1039
foreach (
BoundDecisionDagNode
node in sortedNodes)
1167
var
whenFalse = whenClause.WhenFalse;
1206
private void LowerDecisionDagNode(
BoundDecisionDagNode
node,
BoundDecisionDagNode
nextNode)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (6)
569
foreach (
BoundDecisionDagNode
node in decisionDag.TopologicallySortedNodes)
613
static bool usesOriginalInput(
BoundDecisionDagNode
node)
690
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)
46
protected override LabelSymbol GetDagNodeLabel(
BoundDecisionDagNode
dag)