public override SyntaxList <StatementSyntax> VisitDoLoopBlock(VBSyntax.DoLoopBlockSyntax node)
 {
     if (node.DoStatement.WhileOrUntilClause != null)
     {
         var stmt = node.DoStatement.WhileOrUntilClause;
         if (SyntaxTokenExtensions.IsKind(stmt.WhileOrUntilKeyword, VBasic.SyntaxKind.WhileKeyword))
         {
             return(SingleStatement(SyntaxFactory.WhileStatement(
                                        (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor),
                                        SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor))).UnpackNonNestedBlock()
                                        )));
         }
         return(SingleStatement(SyntaxFactory.WhileStatement(
                                    SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor)),
                                    SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor))).UnpackNonNestedBlock()
                                    )));
     }
     if (node.LoopStatement.WhileOrUntilClause != null)
     {
         var stmt = node.LoopStatement.WhileOrUntilClause;
         if (SyntaxTokenExtensions.IsKind(stmt.WhileOrUntilKeyword, VBasic.SyntaxKind.WhileKeyword))
         {
             return(SingleStatement(SyntaxFactory.DoStatement(
                                        SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor))).UnpackNonNestedBlock(),
                                        (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor)
                                        )));
         }
         return(SingleStatement(SyntaxFactory.DoStatement(
                                    SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor))).UnpackNonNestedBlock(),
                                    SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor))
                                    )));
     }
     throw new NotSupportedException();
 }
            public override SyntaxList <StatementSyntax> VisitDoLoopBlock(VBSyntax.DoLoopBlockSyntax node)
            {
                var statements = SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(CommentConvertingVisitor))).UnpackNonNestedBlock();

                if (node.DoStatement.WhileOrUntilClause != null)
                {
                    var stmt = node.DoStatement.WhileOrUntilClause;
                    if (SyntaxTokenExtensions.IsKind(stmt.WhileOrUntilKeyword, VBasic.SyntaxKind.WhileKeyword))
                    {
                        return(SingleStatement(SyntaxFactory.WhileStatement(
                                                   (ExpressionSyntax)stmt.Condition.Accept(_nodesVisitor),
                                                   statements
                                                   )));
                    }
                    return(SingleStatement(SyntaxFactory.WhileStatement(
                                               ((ExpressionSyntax)stmt.Condition.Accept(_nodesVisitor)).InvertCondition(),
                                               statements
                                               )));
                }

                var whileOrUntilStmt = node.LoopStatement.WhileOrUntilClause;
                ExpressionSyntax conditionExpression;
                bool             isUntilStmt;

                if (whileOrUntilStmt != null)
                {
                    conditionExpression = (ExpressionSyntax)whileOrUntilStmt.Condition.Accept(_nodesVisitor);
                    isUntilStmt         = SyntaxTokenExtensions.IsKind(whileOrUntilStmt.WhileOrUntilKeyword, VBasic.SyntaxKind.UntilKeyword);
                }
                else
                {
                    conditionExpression = SyntaxFactory.LiteralExpression(SyntaxKind.TrueLiteralExpression);
                    isUntilStmt         = false;
                }

                if (isUntilStmt)
                {
                    conditionExpression = conditionExpression.InvertCondition();
                }

                return(SingleStatement(SyntaxFactory.DoStatement(statements, conditionExpression)));
            }
 public override SyntaxList <StatementSyntax> VisitDoLoopBlock(VBSyntax.DoLoopBlockSyntax node)
 {
     if (node.DoStatement.WhileOrUntilClause != null)
     {
         var stmt = node.DoStatement.WhileOrUntilClause;
         if (stmt.WhileOrUntilKeyword.IsKind(VBasic.SyntaxKind.WhileKeyword))
         {
             return(SingleStatement(SyntaxFactory.WhileStatement(
                                        (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor),
                                        SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(this)))
                                        )));
         }
         else
         {
             return(SingleStatement(SyntaxFactory.WhileStatement(
                                        SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor)),
                                        SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(this)))
                                        )));
         }
     }
     if (node.LoopStatement.WhileOrUntilClause != null)
     {
         var stmt = node.LoopStatement.WhileOrUntilClause;
         if (stmt.WhileOrUntilKeyword.IsKind(VBasic.SyntaxKind.WhileKeyword))
         {
             return(SingleStatement(SyntaxFactory.DoStatement(
                                        SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(this))),
                                        (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor)
                                        )));
         }
         else
         {
             return(SingleStatement(SyntaxFactory.DoStatement(
                                        SyntaxFactory.Block(node.Statements.SelectMany(s => s.Accept(this))),
                                        SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, (ExpressionSyntax)stmt.Condition.Accept(nodesVisitor))
                                        )));
         }
     }
     throw new NotSupportedException();
 }
 public override SyntaxList <StatementSyntax> VisitDoLoopBlock(VBSyntax.DoLoopBlockSyntax node) => AddLocalVariables(node);
Beispiel #5
0
 public override Task <SyntaxList <StatementSyntax> > VisitDoLoopBlock(VBSyntax.DoLoopBlockSyntax node) => AddLocalVariablesAsync(node, VBasic.SyntaxKind.DoKeyword, true);