public override SyntaxList <StatementSyntax> VisitUsingBlock(VBSyntax.UsingBlockSyntax node)
 {
     if (node.UsingStatement.Expression == null)
     {
         StatementSyntax stmt = SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(this)));
         foreach (var v in node.UsingStatement.Variables.Reverse())
         {
             foreach (var declaration in SplitVariableDeclarations(v, nodesVisitor, semanticModel).Values.Reverse())
             {
                 stmt = SyntaxFactory.UsingStatement(declaration, null, stmt);
             }
         }
         return(SingleStatement(stmt));
     }
     else
     {
         var expr = (ExpressionSyntax)node.UsingStatement.Expression.Accept(nodesVisitor);
         return(SingleStatement(SyntaxFactory.UsingStatement(null, expr, SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(this))))));
     }
 }
            public override SyntaxList <StatementSyntax> VisitUsingBlock(VBSyntax.UsingBlockSyntax node)
            {
                var statementSyntax = SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor)));

                if (node.UsingStatement.Expression == null)
                {
                    StatementSyntax stmt = statementSyntax;
                    foreach (var v in node.UsingStatement.Variables.Reverse())
                    {
                        foreach (var declaration in CommonConversions.SplitVariableDeclarations(v).Values.Reverse())
                        {
                            stmt = SyntaxFactory.UsingStatement(declaration, null, stmt);
                        }
                    }
                    return(SingleStatement(stmt));
                }

                var expr = (ExpressionSyntax)node.UsingStatement.Expression.Accept(_nodesVisitor);
                var unpackPossiblyNestedBlock = statementSyntax.UnpackPossiblyNestedBlock(); // Allow reduced indentation for multiple usings in a row

                return(SingleStatement(SyntaxFactory.UsingStatement(null, expr, unpackPossiblyNestedBlock)));
            }
예제 #3
0
 public override SyntaxList <StatementSyntax> VisitUsingBlock(VBSyntax.UsingBlockSyntax node) => AddLocalVariables(node);
예제 #4
0
 public override Task <SyntaxList <StatementSyntax> > VisitUsingBlock(VBSyntax.UsingBlockSyntax node) => AddLocalVariablesAsync(node);