Exemplo n.º 1
0
        public void VisitArgumentList(ArgumentListSyntax node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            node.Validate();

            bool spacesWithin;

            if (node.Arguments.Count == 0)
            {
                if (_writer.Configuration.Spaces.BeforeParentheses.MethodCallEmptyParentheses)
                    _writer.WriteSpace();
                spacesWithin = _writer.Configuration.Spaces.WithinParentheses.MethodCallEmptyParentheses;
            }
            else
            {
                if (_writer.Configuration.Spaces.BeforeParentheses.MethodCallParentheses)
                    _writer.WriteSpace();
                spacesWithin = _writer.Configuration.Spaces.WithinParentheses.MethodCallParentheses;
            }

            _writer.WriteSyntax(Syntax.OpenParen);

            if (_writer.Configuration.Other.AlignMultiLineConstructs.CallArguments)
                _writer.SetAlignmentBreak(true);

            if (spacesWithin)
                _writer.WriteSpace();

            bool hadOne = false;

            foreach (var argument in node.Arguments)
            {
                if (hadOne)
                    _writer.WriteListSeparator();
                else
                    hadOne = true;

                argument.Accept(this);
            }

            if (spacesWithin && node.Arguments.Count > 0)
                _writer.WriteSpace();

            if (_writer.Configuration.Other.AlignMultiLineConstructs.CallArguments)
                _writer.SetAlignmentBreak(false);

            _writer.WriteSyntax(Syntax.CloseParen);
        }