public override bool VisitTypeParameter(ITypeParameterSymbol symbol) { if (!IsInScope(symbol)) { // reference to type parameter not in scope, make explicit scope reference var declarer = new DeclarationGenerator(_builder); declarer.Visit(symbol.ContainingSymbol); _builder.Append(":"); } if (symbol.DeclaringMethod != null) { _builder.Append("``"); _builder.Append(symbol.Ordinal); } else { // get count of all type parameter preceding the declaration of the type parameters containing symbol. var container = symbol.ContainingSymbol?.ContainingSymbol; var b = GetTotalTypeParameterCount(container as INamedTypeSymbol); _builder.Append("`"); _builder.Append(b + symbol.Ordinal); } return(true); }
/// <summary> /// Creates an id string used by external documenation comment files to identify declarations /// of types, namespaces, methods, properties, etc. /// </summary> public static string CreateDeclarationId(ISymbol symbol) { var builder = new StringBuilder(); var generator = new DeclarationGenerator(builder); generator.Visit(symbol); return(builder.ToString()); }