//
// Raised (and passed an XmlElement that contains the comment)
// when GenerateDocComment is writing documentation expectedly.
//
// FIXME: with a few effort, it could be done with XmlReader,
// that means removal of DOM use.
//
void CheckParametersComments(MemberCore member, IParametersMember paramMember, XmlElement el)
{
HashSet <string> found_tags = null;
foreach (XmlElement pelem in el.SelectNodes("param"))
{
string xname = pelem.GetAttribute("name");
if (xname.Length == 0)
{
continue; // really? but MS looks doing so
}
if (found_tags == null)
{
found_tags = new HashSet <string> ();
}
if (xname != "" && paramMember.Parameters.GetParameterIndexByName(xname) < 0)
{
Report.Warning(1572, 2, member.Location,
"XML comment on `{0}' has a param tag for `{1}', but there is no parameter by that name",
member.GetSignatureForError(), xname);
continue;
}
if (found_tags.Contains(xname))
{
Report.Warning(1571, 2, member.Location,
"XML comment on `{0}' has a duplicate param tag for `{1}'",
member.GetSignatureForError(), xname);
continue;
}
found_tags.Add(xname);
}
if (found_tags != null)
{
foreach (Parameter p in paramMember.Parameters.FixedParameters)
{
if (!found_tags.Contains(p.Name) && !(p is ArglistParameter))
{
Report.Warning(1573, 4, member.Location,
"Parameter `{0}' has no matching param tag in the XML comment for `{1}'",
p.Name, member.GetSignatureForError());
}
}
}
}