static string GetSignatureForDoc (TypeSpec type)
{
var tp = type as TypeParameterSpec;
if (tp != null) {
int c = 0;
type = type.DeclaringType;
while (type != null && type.DeclaringType != null) {
type = type.DeclaringType;
c += type.MemberDefinition.TypeParametersCount;
}
var prefix = tp.IsMethodOwned ? "``" : "`";
return prefix + (c + tp.DeclaredPosition);
}
var pp = type as PointerContainer;
if (pp != null)
return GetSignatureForDoc (pp.Element) + "*";
ArrayContainer ap = type as ArrayContainer;
if (ap != null)
return GetSignatureForDoc (ap.Element) +
ArrayContainer.GetPostfixSignature (ap.Rank);
if (TypeManager.IsGenericType (type)) {
string g = type.MemberDefinition.Namespace;
if (g != null && g.Length > 0)
g += '.';
int idx = type.Name.LastIndexOf ('`');
g += (idx < 0 ? type.Name : type.Name.Substring (0, idx)) + '{';
int argpos = 0;
foreach (TypeSpec t in TypeManager.GetTypeArguments (type))
g += (argpos++ > 0 ? "," : String.Empty) + GetSignatureForDoc (t);
g += '}';
return g;
}
string name = type.GetMetaInfo ().FullName != null ? type.GetMetaInfo ().FullName : type.Name;
return name.Replace ("+", ".").Replace ('&', '@');
}