public override async Task <CSharpSyntaxNode> VisitCompilationUnit(VbSyntax.CompilationUnitSyntax node)
        {
            var convertedNode = (CsSyntax.CompilationUnitSyntax) await DefaultVisitInner(node);

            // Special case where we need to map manually because it's a special zero-width token that just has leading trivia that isn't at the start of the line necessarily
            return(convertedNode.WithEndOfFileToken(
                       convertedNode.EndOfFileToken.WithSourceMappingFrom(node.EndOfFileToken)
                       ));
        }
Ejemplo n.º 2
0
        public override CSharpSyntaxNode VisitCompilationUnit(VbSyntax.CompilationUnitSyntax node)
        {
            var cSharpSyntaxNode = (CsSyntax.CompilationUnitSyntax)base.VisitCompilationUnit(node);

            cSharpSyntaxNode = cSharpSyntaxNode.WithEndOfFileToken(
                cSharpSyntaxNode.EndOfFileToken.WithConvertedLeadingTriviaFrom(node.EndOfFileToken));

            return(TriviaConverter.IsAllTriviaConverted()
                ? cSharpSyntaxNode
                : cSharpSyntaxNode.WithAppendedTrailingTrivia(SyntaxFactory.Comment("/* Some trivia (e.g. comments) could not be converted */")));
        }
Ejemplo n.º 3
0
 public override SyntaxNode VisitCompilationUnit(Microsoft.CodeAnalysis.VisualBasic.Syntax.CompilationUnitSyntax node)
 => base.VisitCompilationUnit(node.WithImports(
                                  Microsoft.CodeAnalysis.VisualBasic.SyntaxFactory.List <ImportsStatementSyntax>()));