Exemple #1
0
        /// <summary>
        /// Visits the specified constructor.
        /// </summary>
        /// <param name="constructor">The constructor.</param>
        public void Visit(AbstractConstructor constructor)
        {
            if (constructor == null)
            {
                throw new ArgumentNullException("constructor");
            }
            indent();
            writer.Write("{0} {1} (", constructor.Prefix, constructor.NameAndReturn.Name);
            bool isFirst = true;

            foreach (AbstractParameter parameter in constructor.Parameters)
            {
                if (isFirst)
                {
                    isFirst = false;
                }
                else
                {
                    writer.Write(", ");
                }

                parameter.Accept(this);
            }
            string postfix = string.IsNullOrEmpty(constructor.Postfix) ? string.Empty : ": " + constructor.Postfix;

            writer.WriteLine("){0}", postfix);
            renderBody(constructor.Body);
        }
        /// <summary>
        /// Visits the specified constructor.
        /// </summary>
        /// <param name="constructor">The constructor.</param>
        public void Visit(AbstractConstructor constructor)
        {
            if (constructor == null)
                throw new ArgumentNullException("constructor");
            indent();
            writer.Write("{0} {1} (", constructor.Prefix, constructor.NameAndReturn.Name);
            bool isFirst = true;
            foreach (AbstractParameter parameter in constructor.Parameters)
            {
                if (isFirst)
                    isFirst = false;
                else
                    writer.Write(", ");

                parameter.Accept(this);
            }
            string postfix = string.IsNullOrEmpty(constructor.Postfix) ? string.Empty : ": " + constructor.Postfix;
            writer.WriteLine("){0}", postfix);
            renderBody(constructor.Body);
        }