예제 #1
0
        private static VB.StructuredTriviaSyntax CreateBadDirective(CS.SyntaxNode node, NodeVisitor visitor)
        {
            var leadingTrivia = node.GetFirstToken(includeSkipped: true).LeadingTrivia.SelectMany(visitor.VisitTrivia).Where(t => t.Kind != VB.SyntaxKind.EndOfLineTrivia);
            var trailingTrivia = node.GetLastToken(includeSkipped: true).TrailingTrivia.SelectMany(visitor.VisitTrivia).Where(t => t.Kind != VB.SyntaxKind.EndOfLineTrivia);

            var comment = CreateCouldNotBeConvertedComment(node.ToString(), typeof(VB.StatementSyntax));
            leadingTrivia = leadingTrivia.Concat(
                VB.Syntax.CommentTrivia(comment));

            var token = VB.Syntax.Token(TriviaList(leadingTrivia), VB.SyntaxKind.HashToken, trailing: TriviaList(trailingTrivia), text: "");
            return VB.Syntax.DirectiveTrivia(VB.Syntax.BadDirective(token), VB.Syntax.Token(VB.SyntaxKind.StatementTerminatorToken, text: ""));
        }
예제 #2
0
        private static VB.StatementSyntax CreateBadStatement(CS.SyntaxNode node, NodeVisitor visitor)
        {
            var leadingTrivia = node.GetFirstToken(includeSkipped: true).LeadingTrivia.SelectMany(visitor.VisitTrivia);
            var trailingTrivia = node.GetLastToken(includeSkipped: true).TrailingTrivia.SelectMany(visitor.VisitTrivia);

            var comment = CreateCouldNotBeConvertedComment(node.ToString(), typeof(VB.StatementSyntax));
            leadingTrivia = leadingTrivia.Concat(
                VB.Syntax.CommentTrivia(comment));

            var token = VB.Syntax.Token(TriviaList(leadingTrivia), VB.SyntaxKind.EmptyToken, trailing: TriviaList(trailingTrivia));
            return VB.Syntax.EmptyStatement(token);
        }