예제 #1
0
        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}'.");
            }
        }
예제 #2
0
 private static bool EnumerateExpressionDescendant(SyntaxKind kind)
 {
     return(SyntaxUtilities.IsLambda(kind) || kind == SyntaxKind.VariableDeclarator || kind == SyntaxKind.AwaitExpression);
 }