/// <summary> /// Takes an unqualified name and turns it into an imprecise name by /// dropping the type parameter count of simple names and converting /// all other kinds of names into strings. /// </summary> /// <param name="name">The name to convert.</param> /// <returns>An imprecise name.</returns> public static string ToImpreciseName(UnqualifiedName name) { if (name is SimpleName) { return(((SimpleName)name).Name); } else { return(name.ToString()); } }
private static string EncodeUnqualifiedName(UnqualifiedName name) { if (name is SimpleName) { return(EncodeUnqualifiedName(((SimpleName)name).Name)); } // else if (Name is PreMangledName) // { // return ((PreMangledName)Name).MangledName; // } else { return(EncodeUnqualifiedName(name.ToString())); } }
/// <summary> /// Encodes an unqualified name as a simple name. /// </summary> /// <param name="name"> /// An unqualified name to encode. Simple names are encoded /// as such. Other names are encoded as simple names by taking /// their string representation. /// </param> /// <returns>An encoded node.</returns> public LNode Encode(UnqualifiedName name) { if (name is SimpleName) { var simple = (SimpleName)name; var simpleNameNode = Factory.Id(simple.Name); if (simple.TypeParameterCount == 0) { return(simpleNameNode); } else { return(Factory.Call( simpleNameNode, Factory.Literal(simple.TypeParameterCount))); } } else { return(Factory.Id(name.ToString())); } }