未验证 提交 492ff7ba 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #43982 from sharwell/rm-space

Remove trailing space from BoundDecisionDagNode
...@@ -1307,31 +1307,31 @@ ...@@ -1307,31 +1307,31 @@
<Field Name="RootNode" Type="BoundDecisionDagNode" Null="disallow"/> <Field Name="RootNode" Type="BoundDecisionDagNode" Null="disallow"/>
</Node> </Node>
<AbstractNode Name="BoundDecisionDagNode " Base="BoundNode"> <AbstractNode Name="BoundDecisionDagNode" Base="BoundNode">
</AbstractNode> </AbstractNode>
<!-- This node is used to indicate a point in the decision dag where an evaluation is performed, such as invoking Deconstruct. --> <!-- This node is used to indicate a point in the decision dag where an evaluation is performed, such as invoking Deconstruct. -->
<Node Name="BoundEvaluationDecisionDagNode" Base="BoundDecisionDagNode "> <Node Name="BoundEvaluationDecisionDagNode" Base="BoundDecisionDagNode">
<Field Name="Evaluation" Type="BoundDagEvaluation" Null="disallow"/> <Field Name="Evaluation" Type="BoundDagEvaluation" Null="disallow"/>
<Field Name="Next" Type="BoundDecisionDagNode " Null="disallow"/> <Field Name="Next" Type="BoundDecisionDagNode" Null="disallow"/>
</Node> </Node>
<!-- This node is used to indicate a point in the decision dag where a test may change the path of the decision dag. --> <!-- This node is used to indicate a point in the decision dag where a test may change the path of the decision dag. -->
<Node Name="BoundTestDecisionDagNode" Base="BoundDecisionDagNode "> <Node Name="BoundTestDecisionDagNode" Base="BoundDecisionDagNode">
<Field Name="Test" Type="BoundDagTest" Null="disallow"/> <Field Name="Test" Type="BoundDagTest" Null="disallow"/>
<Field Name="WhenTrue" Type="BoundDecisionDagNode " Null="disallow"/> <Field Name="WhenTrue" Type="BoundDecisionDagNode" Null="disallow"/>
<Field Name="WhenFalse" Type="BoundDecisionDagNode " Null="disallow"/> <Field Name="WhenFalse" Type="BoundDecisionDagNode" Null="disallow"/>
</Node> </Node>
<Node Name="BoundWhenDecisionDagNode" Base="BoundDecisionDagNode "> <Node Name="BoundWhenDecisionDagNode" Base="BoundDecisionDagNode">
<Field Name="Bindings" Type="ImmutableArray&lt;BoundPatternBinding&gt;" Null="disallow"/> <Field Name="Bindings" Type="ImmutableArray&lt;BoundPatternBinding&gt;" Null="disallow"/>
<!-- <!--
WhenExpression is null when there was no when clause in source but there are bindings. WhenExpression is null when there was no when clause in source but there are bindings.
In that case WhenFalse is null. In that case WhenFalse is null.
--> -->
<Field Name="WhenExpression" Type="BoundExpression?"/> <Field Name="WhenExpression" Type="BoundExpression?"/>
<Field Name="WhenTrue" Type="BoundDecisionDagNode " Null="disallow"/> <Field Name="WhenTrue" Type="BoundDecisionDagNode" Null="disallow"/>
<Field Name="WhenFalse" Type="BoundDecisionDagNode ?"/> <Field Name="WhenFalse" Type="BoundDecisionDagNode?"/>
</Node> </Node>
<!-- This node is used to indicate a point in the decision dag where the decision has been completed. --> <!-- This node is used to indicate a point in the decision dag where the decision has been completed. -->
<Node Name="BoundLeafDecisionDagNode" Base="BoundDecisionDagNode "> <Node Name="BoundLeafDecisionDagNode" Base="BoundDecisionDagNode">
<Field Name="Label" Type="LabelSymbol"/> <Field Name="Label" Type="LabelSymbol"/>
</Node> </Node>
......
...@@ -4410,17 +4410,8 @@ public BoundConvertedSwitchExpression Update(TypeSymbol? naturalTypeOpt, bool wa ...@@ -4410,17 +4410,8 @@ public BoundConvertedSwitchExpression Update(TypeSymbol? naturalTypeOpt, bool wa
internal sealed partial class BoundDecisionDag : BoundNode internal sealed partial class BoundDecisionDag : BoundNode
{ {
public BoundDecisionDag(SyntaxNode syntax, BoundDecisionDagNode rootNode, bool hasErrors) public BoundDecisionDag(SyntaxNode syntax, BoundDecisionDagNode rootNode, bool hasErrors = false)
: base(BoundKind.DecisionDag, syntax, hasErrors) : base(BoundKind.DecisionDag, syntax, hasErrors || rootNode.HasErrors())
{
RoslynDebug.Assert(rootNode is object, "Field 'rootNode' cannot be null (make the type nullable in BoundNodes.xml to remove this check)");
this.RootNode = rootNode;
}
public BoundDecisionDag(SyntaxNode syntax, BoundDecisionDagNode rootNode)
: base(BoundKind.DecisionDag, syntax)
{ {
RoslynDebug.Assert(rootNode is object, "Field 'rootNode' cannot be null (make the type nullable in BoundNodes.xml to remove this check)"); RoslynDebug.Assert(rootNode is object, "Field 'rootNode' cannot be null (make the type nullable in BoundNodes.xml to remove this check)");
...@@ -4445,23 +4436,23 @@ public BoundDecisionDag Update(BoundDecisionDagNode rootNode) ...@@ -4445,23 +4436,23 @@ public BoundDecisionDag Update(BoundDecisionDagNode rootNode)
} }
} }
internal abstract partial class BoundDecisionDagNode : BoundNode internal abstract partial class BoundDecisionDagNode : BoundNode
{ {
protected BoundDecisionDagNode (BoundKind kind, SyntaxNode syntax, bool hasErrors) protected BoundDecisionDagNode(BoundKind kind, SyntaxNode syntax, bool hasErrors)
: base(kind, syntax, hasErrors) : base(kind, syntax, hasErrors)
{ {
} }
protected BoundDecisionDagNode (BoundKind kind, SyntaxNode syntax) protected BoundDecisionDagNode(BoundKind kind, SyntaxNode syntax)
: base(kind, syntax) : base(kind, syntax)
{ {
} }
} }
internal sealed partial class BoundEvaluationDecisionDagNode : BoundDecisionDagNode internal sealed partial class BoundEvaluationDecisionDagNode : BoundDecisionDagNode
{ {
public BoundEvaluationDecisionDagNode(SyntaxNode syntax, BoundDagEvaluation evaluation, BoundDecisionDagNode next, bool hasErrors = false) public BoundEvaluationDecisionDagNode(SyntaxNode syntax, BoundDagEvaluation evaluation, BoundDecisionDagNode next, bool hasErrors = false)
: base(BoundKind.EvaluationDecisionDagNode, syntax, hasErrors || evaluation.HasErrors() || next.HasErrors()) : base(BoundKind.EvaluationDecisionDagNode, syntax, hasErrors || evaluation.HasErrors() || next.HasErrors())
{ {
...@@ -4475,11 +4466,11 @@ public BoundEvaluationDecisionDagNode(SyntaxNode syntax, BoundDagEvaluation eval ...@@ -4475,11 +4466,11 @@ public BoundEvaluationDecisionDagNode(SyntaxNode syntax, BoundDagEvaluation eval
public BoundDagEvaluation Evaluation { get; } public BoundDagEvaluation Evaluation { get; }
public BoundDecisionDagNode Next { get; } public BoundDecisionDagNode Next { get; }
[DebuggerStepThrough] [DebuggerStepThrough]
public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitEvaluationDecisionDagNode(this); public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitEvaluationDecisionDagNode(this);
public BoundEvaluationDecisionDagNode Update(BoundDagEvaluation evaluation, BoundDecisionDagNode next) public BoundEvaluationDecisionDagNode Update(BoundDagEvaluation evaluation, BoundDecisionDagNode next)
{ {
if (evaluation != this.Evaluation || next != this.Next) if (evaluation != this.Evaluation || next != this.Next)
{ {
...@@ -4491,9 +4482,9 @@ public BoundEvaluationDecisionDagNode Update(BoundDagEvaluation evaluation, Boun ...@@ -4491,9 +4482,9 @@ public BoundEvaluationDecisionDagNode Update(BoundDagEvaluation evaluation, Boun
} }
} }
internal sealed partial class BoundTestDecisionDagNode : BoundDecisionDagNode internal sealed partial class BoundTestDecisionDagNode : BoundDecisionDagNode
{ {
public BoundTestDecisionDagNode(SyntaxNode syntax, BoundDagTest test, BoundDecisionDagNode whenTrue, BoundDecisionDagNode whenFalse, bool hasErrors = false) public BoundTestDecisionDagNode(SyntaxNode syntax, BoundDagTest test, BoundDecisionDagNode whenTrue, BoundDecisionDagNode whenFalse, bool hasErrors = false)
: base(BoundKind.TestDecisionDagNode, syntax, hasErrors || test.HasErrors() || whenTrue.HasErrors() || whenFalse.HasErrors()) : base(BoundKind.TestDecisionDagNode, syntax, hasErrors || test.HasErrors() || whenTrue.HasErrors() || whenFalse.HasErrors())
{ {
...@@ -4509,13 +4500,13 @@ public BoundTestDecisionDagNode(SyntaxNode syntax, BoundDagTest test, BoundDecis ...@@ -4509,13 +4500,13 @@ public BoundTestDecisionDagNode(SyntaxNode syntax, BoundDagTest test, BoundDecis
public BoundDagTest Test { get; } public BoundDagTest Test { get; }
public BoundDecisionDagNode WhenTrue { get; } public BoundDecisionDagNode WhenTrue { get; }
public BoundDecisionDagNode WhenFalse { get; } public BoundDecisionDagNode WhenFalse { get; }
[DebuggerStepThrough] [DebuggerStepThrough]
public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitTestDecisionDagNode(this); public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitTestDecisionDagNode(this);
public BoundTestDecisionDagNode Update(BoundDagTest test, BoundDecisionDagNode whenTrue, BoundDecisionDagNode whenFalse) public BoundTestDecisionDagNode Update(BoundDagTest test, BoundDecisionDagNode whenTrue, BoundDecisionDagNode whenFalse)
{ {
if (test != this.Test || whenTrue != this.WhenTrue || whenFalse != this.WhenFalse) if (test != this.Test || whenTrue != this.WhenTrue || whenFalse != this.WhenFalse)
{ {
...@@ -4527,9 +4518,9 @@ public BoundTestDecisionDagNode Update(BoundDagTest test, BoundDecisionDagNode ...@@ -4527,9 +4518,9 @@ public BoundTestDecisionDagNode Update(BoundDagTest test, BoundDecisionDagNode
} }
} }
internal sealed partial class BoundWhenDecisionDagNode : BoundDecisionDagNode internal sealed partial class BoundWhenDecisionDagNode : BoundDecisionDagNode
{ {
public BoundWhenDecisionDagNode(SyntaxNode syntax, ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression, BoundDecisionDagNode whenTrue, BoundDecisionDagNode ? whenFalse, bool hasErrors = false) public BoundWhenDecisionDagNode(SyntaxNode syntax, ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression, BoundDecisionDagNode whenTrue, BoundDecisionDagNode? whenFalse, bool hasErrors = false)
: base(BoundKind.WhenDecisionDagNode, syntax, hasErrors || whenExpression.HasErrors() || whenTrue.HasErrors() || whenFalse.HasErrors()) : base(BoundKind.WhenDecisionDagNode, syntax, hasErrors || whenExpression.HasErrors() || whenTrue.HasErrors() || whenFalse.HasErrors())
{ {
...@@ -4547,13 +4538,13 @@ public BoundWhenDecisionDagNode(SyntaxNode syntax, ImmutableArray<BoundPatternBi ...@@ -4547,13 +4538,13 @@ public BoundWhenDecisionDagNode(SyntaxNode syntax, ImmutableArray<BoundPatternBi
public BoundExpression? WhenExpression { get; } public BoundExpression? WhenExpression { get; }
public BoundDecisionDagNode WhenTrue { get; } public BoundDecisionDagNode WhenTrue { get; }
public BoundDecisionDagNode ? WhenFalse { get; } public BoundDecisionDagNode? WhenFalse { get; }
[DebuggerStepThrough] [DebuggerStepThrough]
public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitWhenDecisionDagNode(this); public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitWhenDecisionDagNode(this);
public BoundWhenDecisionDagNode Update(ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression, BoundDecisionDagNode whenTrue, BoundDecisionDagNode ? whenFalse) public BoundWhenDecisionDagNode Update(ImmutableArray<BoundPatternBinding> bindings, BoundExpression? whenExpression, BoundDecisionDagNode whenTrue, BoundDecisionDagNode? whenFalse)
{ {
if (bindings != this.Bindings || whenExpression != this.WhenExpression || whenTrue != this.WhenTrue || whenFalse != this.WhenFalse) if (bindings != this.Bindings || whenExpression != this.WhenExpression || whenTrue != this.WhenTrue || whenFalse != this.WhenFalse)
{ {
...@@ -4565,7 +4556,7 @@ public BoundWhenDecisionDagNode Update(ImmutableArray<BoundPatternBinding> bindi ...@@ -4565,7 +4556,7 @@ public BoundWhenDecisionDagNode Update(ImmutableArray<BoundPatternBinding> bindi
} }
} }
internal sealed partial class BoundLeafDecisionDagNode : BoundDecisionDagNode internal sealed partial class BoundLeafDecisionDagNode : BoundDecisionDagNode
{ {
public BoundLeafDecisionDagNode(SyntaxNode syntax, LabelSymbol label, bool hasErrors) public BoundLeafDecisionDagNode(SyntaxNode syntax, LabelSymbol label, bool hasErrors)
: base(BoundKind.LeafDecisionDagNode, syntax, hasErrors) : base(BoundKind.LeafDecisionDagNode, syntax, hasErrors)
...@@ -9005,7 +8996,11 @@ internal abstract partial class BoundTreeWalker: BoundTreeVisitor ...@@ -9005,7 +8996,11 @@ internal abstract partial class BoundTreeWalker: BoundTreeVisitor
this.VisitList(node.SwitchArms); this.VisitList(node.SwitchArms);
return null; return null;
} }
public override BoundNode? VisitDecisionDag(BoundDecisionDag node) => null; public override BoundNode? VisitDecisionDag(BoundDecisionDag node)
{
this.Visit(node.RootNode);
return null;
}
public override BoundNode? VisitEvaluationDecisionDagNode(BoundEvaluationDecisionDagNode node) public override BoundNode? VisitEvaluationDecisionDagNode(BoundEvaluationDecisionDagNode node)
{ {
this.Visit(node.Evaluation); this.Visit(node.Evaluation);
...@@ -10048,25 +10043,29 @@ internal abstract partial class BoundTreeRewriter : BoundTreeVisitor ...@@ -10048,25 +10043,29 @@ internal abstract partial class BoundTreeRewriter : BoundTreeVisitor
TypeSymbol? type = this.VisitType(node.Type); TypeSymbol? type = this.VisitType(node.Type);
return node.Update(naturalTypeOpt, node.WasTargetTyped, expression, switchArms, decisionDag, node.DefaultLabel, node.ReportedNotExhaustive, type); return node.Update(naturalTypeOpt, node.WasTargetTyped, expression, switchArms, decisionDag, node.DefaultLabel, node.ReportedNotExhaustive, type);
} }
public override BoundNode? VisitDecisionDag(BoundDecisionDag node) => node; public override BoundNode? VisitDecisionDag(BoundDecisionDag node)
{
BoundDecisionDagNode rootNode = (BoundDecisionDagNode)this.Visit(node.RootNode);
return node.Update(rootNode);
}
public override BoundNode? VisitEvaluationDecisionDagNode(BoundEvaluationDecisionDagNode node) public override BoundNode? VisitEvaluationDecisionDagNode(BoundEvaluationDecisionDagNode node)
{ {
BoundDagEvaluation evaluation = (BoundDagEvaluation)this.Visit(node.Evaluation); BoundDagEvaluation evaluation = (BoundDagEvaluation)this.Visit(node.Evaluation);
BoundDecisionDagNode next = (BoundDecisionDagNode )this.Visit(node.Next); BoundDecisionDagNode next = (BoundDecisionDagNode)this.Visit(node.Next);
return node.Update(evaluation, next); return node.Update(evaluation, next);
} }
public override BoundNode? VisitTestDecisionDagNode(BoundTestDecisionDagNode node) public override BoundNode? VisitTestDecisionDagNode(BoundTestDecisionDagNode node)
{ {
BoundDagTest test = (BoundDagTest)this.Visit(node.Test); BoundDagTest test = (BoundDagTest)this.Visit(node.Test);
BoundDecisionDagNode whenTrue = (BoundDecisionDagNode )this.Visit(node.WhenTrue); BoundDecisionDagNode whenTrue = (BoundDecisionDagNode)this.Visit(node.WhenTrue);
BoundDecisionDagNode whenFalse = (BoundDecisionDagNode )this.Visit(node.WhenFalse); BoundDecisionDagNode whenFalse = (BoundDecisionDagNode)this.Visit(node.WhenFalse);
return node.Update(test, whenTrue, whenFalse); return node.Update(test, whenTrue, whenFalse);
} }
public override BoundNode? VisitWhenDecisionDagNode(BoundWhenDecisionDagNode node) public override BoundNode? VisitWhenDecisionDagNode(BoundWhenDecisionDagNode node)
{ {
BoundExpression? whenExpression = (BoundExpression?)this.Visit(node.WhenExpression); BoundExpression? whenExpression = (BoundExpression?)this.Visit(node.WhenExpression);
BoundDecisionDagNode whenTrue = (BoundDecisionDagNode )this.Visit(node.WhenTrue); BoundDecisionDagNode whenTrue = (BoundDecisionDagNode)this.Visit(node.WhenTrue);
BoundDecisionDagNode ? whenFalse = (BoundDecisionDagNode ?)this.Visit(node.WhenFalse); BoundDecisionDagNode? whenFalse = (BoundDecisionDagNode?)this.Visit(node.WhenFalse);
return node.Update(node.Bindings, whenExpression, whenTrue, whenFalse); return node.Update(node.Bindings, whenExpression, whenTrue, whenFalse);
} }
public override BoundNode? VisitLeafDecisionDagNode(BoundLeafDecisionDagNode node) => node; public override BoundNode? VisitLeafDecisionDagNode(BoundLeafDecisionDagNode node) => node;
...@@ -13841,7 +13840,7 @@ public override TreeDumperNode VisitYieldBreakStatement(BoundYieldBreakStatement ...@@ -13841,7 +13840,7 @@ public override TreeDumperNode VisitYieldBreakStatement(BoundYieldBreakStatement
); );
public override TreeDumperNode VisitDecisionDag(BoundDecisionDag node, object? arg) => new TreeDumperNode("decisionDag", null, new TreeDumperNode[] public override TreeDumperNode VisitDecisionDag(BoundDecisionDag node, object? arg) => new TreeDumperNode("decisionDag", null, new TreeDumperNode[]
{ {
new TreeDumperNode("rootNode", node.RootNode, null), new TreeDumperNode("rootNode", null, new TreeDumperNode[] { Visit(node.RootNode, null) }),
new TreeDumperNode("hasErrors", node.HasErrors, null) new TreeDumperNode("hasErrors", node.HasErrors, null)
} }
); );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册