public override SyntaxList <StatementSyntax> VisitSingleLineIfStatement(VBSyntax.SingleLineIfStatementSyntax node)
            {
                var condition = (ExpressionSyntax)node.Condition.Accept(_nodesVisitor);
                var block     = SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor)));
                ElseClauseSyntax elseClause = null;

                if (node.ElseClause != null)
                {
                    var elseBlock = SyntaxFactory.Block(node.ElseClause.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor)));
                    elseClause = SyntaxFactory.ElseClause(elseBlock.UnpackNonNestedBlock());
                }
                return(SingleStatement(SyntaxFactory.IfStatement(condition, block.UnpackNonNestedBlock(), elseClause)));
            }
            public override SyntaxList <StatementSyntax> VisitSingleLineIfStatement(VBSyntax.SingleLineIfStatementSyntax node)
            {
                var condition = (ExpressionSyntax)node.Condition.Accept(nodesVisitor);
                var block     = SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(this)));
                ElseClauseSyntax elseClause = null;

                if (node.ElseClause != null)
                {
                    var elseBlock = SyntaxFactory.Block(node.ElseClause.Statements.SelectMany(s => s.Accept(this)));
                    elseClause = SyntaxFactory.ElseClause(elseBlock.Statements.Count == 1 ? elseBlock.Statements[0] : elseBlock);
                }
                return(SingleStatement(SyntaxFactory.IfStatement(condition, block.Statements.Count == 1 ? block.Statements[0] : block, elseClause)));
            }
예제 #3
0
 public override SyntaxList <StatementSyntax> VisitSingleLineIfStatement(VBSyntax.SingleLineIfStatementSyntax node) => AddLocalVariables(node);