private void VerifySyntaxMap(string oldSource, string newSource) { var oldRoot = SyntaxFactory.ParseSyntaxTree(oldSource).GetRoot(); var newRoot = SyntaxFactory.ParseSyntaxTree(newSource).GetRoot(); foreach (var oldNode in oldRoot.DescendantNodes().Where(n => n.FullSpan.Length > 0)) { var newNode = SyntaxUtilities.FindPartner(oldRoot, newRoot, oldNode); Assert.True(SyntaxFactory.AreEquivalent(oldNode, newNode), $"Node '{oldNode}' not equivalent to '{newNode}'."); } }
private static bool EnumerateExpressionDescendant(SyntaxKind kind) { return(SyntaxUtilities.IsLambda(kind) || kind == SyntaxKind.VariableDeclarator || kind == SyntaxKind.AwaitExpression); }