//
// Generates xml doc comments (if any), and if required,
// handle warning report.
//
internal static void GenerateDocComment(MemberCore mc,
DeclSpace ds, Report Report)
{
if (mc.DocComment != null) {
string name = mc.GetDocCommentName (ds);
XmlNode n = GetDocCommentNode (mc, name, Report);
XmlElement el = n as XmlElement;
if (el != null) {
mc.OnGenerateDocComment (el);
// FIXME: it could be done with XmlReader
XmlNodeList nl = n.SelectNodes (".//include");
if (nl.Count > 0) {
// It could result in current node removal, so prepare another list to iterate.
var al = new List<XmlNode> (nl.Count);
foreach (XmlNode inc in nl)
al.Add (inc);
foreach (XmlElement inc in al)
if (!HandleInclude (mc, inc, Report))
inc.ParentNode.RemoveChild (inc);
}
// FIXME: it could be done with XmlReader
DeclSpace ds_target = mc as DeclSpace;
if (ds_target == null)
ds_target = ds;
foreach (XmlElement see in n.SelectNodes (".//see"))
HandleSee (mc, ds_target, see, Report);
foreach (XmlElement seealso in n.SelectNodes (".//seealso"))
HandleSeeAlso (mc, ds_target, seealso ,Report);
foreach (XmlElement see in n.SelectNodes (".//exception"))
HandleException (mc, ds_target, see, Report);
}
n.WriteTo (RootContext.Documentation.XmlCommentOutput);
}
else if (mc.IsExposedFromAssembly ()) {
Constructor c = mc as Constructor;
if (c == null || !c.IsDefault ())
Report.Warning (1591, 4, mc.Location,
"Missing XML comment for publicly visible type or member `{0}'", mc.GetSignatureForError ());
}
}