Пример #1
0
        public override void VisitParameterList(ParameterListSyntax node)
        {
            this.WriteToken(node.OpenParenToken);

            var firstParameter = true;

            var tkns = node.ChildTokens().First().ToFullString().Replace("(", ",");

            foreach (var parameter in node.Parameters)
            {
                if (parameter.AttributeLists.TryMatchAttributeName <RepeatAttribute>(out var attributeSyntax))
                {
                    this.subRepeatAttributes.Add(attributeSyntax);

                    this.strategy.RepeatDeclaration(
                        attributeSyntax,
                        itemStrategy =>
                    {
                        if (firstParameter)
                        {
                            firstParameter = false;
                        }
                        else
                        {
                            this.Write(tkns);
                        }

                        new AutomatedWalker(this.writer, this.pattern, itemStrategy)
                        .WriteParameter(parameter);
                    });
                }
                else
                {
                    if (firstParameter)
                    {
                        firstParameter = false;
                    }
                    else
                    {
                        this.Write(tkns);
                    }

                    this.WriteParameter(parameter);
                }
            }

            this.WriteToken(node.CloseParenToken);
        }