MonoDevelop.CSharp.Parser.CSharpParser.InsertComment C# (CSharp) Method

InsertComment() public static method

public static InsertComment ( AstNode node, MonoDevelop comment ) : void
node AstNode
comment MonoDevelop
return void
		public static void InsertComment (AstNode node, MonoDevelop.CSharp.Ast.Comment comment)
		{
			if (node.EndLocation < comment.StartLocation) {
				node.AddChild (comment, AstNode.Roles.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, AstNode.Roles.Comment);
					return;
				}
			}
			
			node.AddChild (comment, AstNode.Roles.Comment);
		}