예제 #1
0
        public void VisitWhileStatement(WhileStatementSyntax node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            node.Validate();

            WriteLeadingTrivia(node);

            _writer.WriteIndent();
            _writer.WriteKeyword(PrinterKeyword.While);

            if (_writer.Configuration.Spaces.BeforeParentheses.WhileParentheses)
                _writer.WriteSpace();

            _writer.WriteSyntax(Syntax.OpenParen);

            if (_writer.Configuration.Spaces.WithinParentheses.WhileParentheses)
                _writer.WriteSpace();

            _wrapCompound = _writer.Configuration.LineBreaksAndWrapping.LineWrapping.ForceChopCompoundConditionInWhileStatement;

            node.Condition.Accept(this);

            _wrapCompound = false;

            if (_writer.Configuration.Spaces.WithinParentheses.WhileParentheses)
                _writer.WriteSpace();

            _writer.WriteSyntax(Syntax.CloseParen);

            VisitBlockStatement(node.Statement);

            WriteTrailingTrivia(node);
        }