n.WriteTo (RootContext.Documentation.XmlCommentOutput);
}
- else if (mc.IsExposedFromAssembly (ds) &&
- // There are no warnings when the container also
- // misses documentations.
- (ds == null || ds.DocComment != null))
- {
- Report.Warning (1591, 4, mc.Location,
- "Missing XML comment for publicly visible type or member '{0}'", mc.GetSignatureForError ());
+ else if (mc.IsExposedFromAssembly (ds)) {
+ 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 ());
}
}
// returns a full runtime type name from a name which might
// be C# specific type name.
//
- private static Type FindDocumentedType (MemberCore mc,
- string name, DeclSpace ds, bool allowAlias)
+ private static Type FindDocumentedType (MemberCore mc, string name, DeclSpace ds, string cref)
{
bool isArray = false;
string identifier = name;
isArray = true;
}
}
- Type t = FindDocumentedTypeNonArray (mc, identifier,
- ds, allowAlias);
+ Type t = FindDocumentedTypeNonArray (mc, identifier, ds, cref);
if (t != null && isArray)
t = Array.CreateInstance (t, 0).GetType ();
return t;
}
- private static Type FindDocumentedTypeNonArray (MemberCore mc,
- string identifier, DeclSpace ds, bool allowAlias)
+ private static Type FindDocumentedTypeNonArray (MemberCore mc,
+ string identifier, DeclSpace ds, string cref)
{
switch (identifier) {
case "int":
case "void":
return typeof (void);
}
- if (allowAlias) {
- IAlias alias = ds.LookupAlias (identifier);
- if (alias != null)
- identifier = alias.Name;
- }
- Type t = ds.FindType (mc.Location, identifier);
- if (t == null)
- t = TypeManager.LookupTypeDirect (identifier);
- return t;
+ FullNamedExpression e = ds.FindType (mc.Location, identifier);
+ if (e != null) {
+ if (!(e is TypeExpr))
+ return null;
+ return ((TypeExpr) e).ResolveType (ds.EmitContext);
+ }
+ int index = identifier.LastIndexOf ('.');
+ if (index < 0)
+ return null;
+ int warn;
+ Type parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref);
+ if (parent == null)
+ return null;
+ return FindDocumentedMember (mc, parent,
+ identifier.Substring (index + 1),
+ Type.EmptyTypes,
+ ds, out warn, cref) as Type;
}
//
((PropertyInfo) mi).PropertyType :
null;
if (returnTypeName != null) {
- Type returnType = FindDocumentedType (mc, returnTypeName, ds, true);
+ Type returnType = FindDocumentedType (mc, returnTypeName, ds, cref);
if (returnType == null || returnType != expected) {
warningType = 1581;
Report.Warning (1581, 1, mc.Location, "Invalid return type in XML comment cref attribute '{0}'", cref);
return mis [0];
}
- private static Type [] emptyParamList = new Type [0];
-
//
// Processes "see" or "seealso" elements.
// Checks cref attribute.
string signature; // "x:" are stripped
string name; // method invokation "(...)" are removed
- string identifiers; // array indexer "[]" are removed
string parameters; // method parameter list
// strip 'T:' 'M:' 'F:' 'P:' 'E:' etc.
}
// check if parameters are valid
- Type [] parameterTypes = emptyParamList;
+ Type [] parameterTypes = Type.EmptyTypes;
if (parameters.Length > 0) {
string [] paramList = parameters.Split (',');
ArrayList plist = new ArrayList ();
for (int i = 0; i < paramList.Length; i++) {
string paramTypeName = paramList [i].Trim (wsChars);
- Type paramType = FindDocumentedType (mc, paramTypeName, ds, true);
+ Type paramType = FindDocumentedType (mc, paramTypeName, ds, cref);
if (paramType == null) {
Report.Warning (1580, 1, mc.Location, "Invalid type for parameter '{0}' in XML comment cref attribute '{1}'", i + 1, cref);
return;
parameters = sb.ToString ();
}
- Type type = FindDocumentedType (mc, name, ds, true);
+ Type type = FindDocumentedType (mc, name, ds, cref);
if (type != null) {
xref.SetAttribute ("cref", "T:" + type.FullName.Replace ("+", "."));
return; // a type
if (period > 0) {
string typeName = name.Substring (0, period);
string memberName = name.Substring (period + 1);
- type = FindDocumentedType (mc, typeName, ds, false);
+ type = FindDocumentedType (mc, typeName, ds, cref);
int warnResult;
if (type != null) {
MemberInfo mi = FindDocumentedMember (mc, type, memberName, parameterTypes, ds, out warnResult, cref);
paramTags [xname] = xname;
}
Parameter [] plist = mc.Parameters.FixedParameters;
- Parameter parr = mc.Parameters.ArrayParameter;
if (plist != null) {
foreach (Parameter p in plist) {
if (paramTags.Count > 0 && paramTags [p.Name] == null)