提交 b1b41e03 编写于 作者: S Sam Harwell

Update TopSyntaxComparer for top-level statements

上级 1b2c0b38
......@@ -9766,7 +9766,7 @@ public void TupleType_LocalVariables()
"Update [y = (3, 4)]@56 -> [y2 = (3, 4)]@96");
}
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/44423")]
[Fact]
[WorkItem(44423, "https://github.com/dotnet/roslyn/issues/44423")]
public void TupleElementName()
{
......
......@@ -106,6 +106,7 @@ internal enum Label
IndexerDeclaration, // tied to parent
EventDeclaration, // tied to parent
EnumMemberDeclaration, // tied to parent
GlobalStatement, // tied to parent
AccessorList, // tied to parent
AccessorDeclaration, // tied to parent
......@@ -145,6 +146,7 @@ private static int TiedToAncestor(Label label)
case Label.IndexerDeclaration:
case Label.EventDeclaration:
case Label.EnumMemberDeclaration:
case Label.GlobalStatement:
case Label.AccessorDeclaration:
case Label.AccessorList:
case Label.TypeParameterList:
......@@ -172,9 +174,8 @@ internal static Label Classify(SyntaxKind kind, out bool isLeaf)
return Label.CompilationUnit;
case SyntaxKind.GlobalStatement:
// TODO:
isLeaf = true;
return Label.Ignored;
isLeaf = false;
return Label.GlobalStatement;
case SyntaxKind.ExternAliasDirective:
isLeaf = true;
......@@ -339,6 +340,7 @@ public override bool ValuesEqual(SyntaxNode left, SyntaxNode right)
case SyntaxKind.SetAccessorDeclaration:
case SyntaxKind.AddAccessorDeclaration:
case SyntaxKind.RemoveAccessorDeclaration:
case SyntaxKind.GlobalStatement:
// When comparing method bodies we need to NOT ignore VariableDeclaration and VariableDeclarator children,
// but when comparing field definitions we should ignore VariableDeclarations children.
......@@ -375,6 +377,7 @@ private static SyntaxNode GetBody(SyntaxNode node)
{
case BaseMethodDeclarationSyntax baseMethodDeclarationSyntax: return baseMethodDeclarationSyntax.Body ?? (SyntaxNode)baseMethodDeclarationSyntax.ExpressionBody?.Expression;
case AccessorDeclarationSyntax accessorDeclarationSyntax: return accessorDeclarationSyntax.Body ?? (SyntaxNode)accessorDeclarationSyntax.ExpressionBody?.Expression;
case GlobalStatementSyntax globalStatement: return globalStatement.Statement;
default: throw ExceptionUtilities.UnexpectedValue(node);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册