Example #1
0
		public void InsertComment (DomNode node, MonoDevelop.CSharp.Dom.Comment comment)
		{
			if (node.EndLocation < comment.StartLocation) {
				node.AddChild (comment);
				return;
			}
			
			foreach (var child in node.Children) {
				if (child.StartLocation < comment.StartLocation && comment.StartLocation < child.EndLocation) {
					InsertComment (child, comment);
					return;
				}
				if (comment.StartLocation < child.StartLocation) {
					node.InsertChildBefore (child, comment, DomNode.Roles.Comment);
					return;
				}
			}
			
			node.AddChild (comment);
		}