Code element base class for elements with header comments.
Inheritance: CodeElement
Beispiel #1
0
        /// <summary>
        /// Creates a clone of the instance and assigns any state.
        /// </summary>
        /// <returns>Clone of this instance.</returns>
        public override object Clone()
        {
            CommentedElement clone = base.Clone() as CommentedElement;

            foreach (ICommentElement comment in HeaderComments)
            {
                ICommentElement commentClone = comment.Clone() as ICommentElement;
                clone.AddHeaderComment(commentClone);
            }

            return(clone);
        }
        /// <summary>
        /// Parses a member block.
        /// </summary>
        /// <param name="beginExpected">Begin block character expected.</param>
        /// <param name="parentElement">Element to parse the block for.</param>
        /// <returns>Block text.</returns>
        private string ParseBlock(bool beginExpected, CommentedElement parentElement)
        {
            List<ICommentElement> extraComments = new List<ICommentElement>();

            if (beginExpected)
            {
                // TODO: Assign any parsed comments to the parent element
                extraComments.AddRange(ParseComments());

                if (parentElement != null)
                {
                    foreach (ICommentElement comment in extraComments)
                    {
                        parentElement.AddHeaderComment(comment);
                    }
                }
            }

            return ParseNestedText(CSharpSymbol.BeginBlock, CSharpSymbol.EndBlock, beginExpected, true);
        }