Exemplo n.º 1
0
        private static CommonSyntaxNode TransformRootVisualBasic(Roslyn.Compilers.VisualBasic.SyntaxNode originalRoot)
        {
            var comments = originalRoot.DescendantTrivia().Where(t => t.Kind == Roslyn.Compilers.VisualBasic.SyntaxKind.CommentTrivia);
            var newRoot  = originalRoot.ReplaceTrivia(comments, (t1, t2) => Roslyn.Compilers.VisualBasic.SyntaxTriviaList.Empty);

            return(newRoot);
        }
 private static VB.StatementSyntax ConvertToStatement(VB.SyntaxNode node)
 {
     if (node == null)
     {
         return(null);
     }
     else if (node is VB.StatementSyntax)
     {
         return((VB.StatementSyntax)node);
     }
     else if (node is VB.InvocationExpressionSyntax)
     {
         return(VB.Syntax.CallStatement(
                    default(VB.SyntaxToken),
                    (VB.InvocationExpressionSyntax)node));
     }
     else
     {
         // can happen in error scenarios
         return(CreateBadStatement(((CommonSyntaxNode)node).ToFullString(), typeof(VB.StatementSyntax)));
     }
 }