// public static string TypeDefToString(TypeSignature type) => // type.ReflectionName(); // public static string TypeToString(TypeReference type) => // type.Match( // st => st.Type.TypeParameters.Length == 0 ? TypeDefToString // type is TS.ITypeDefinition td ? TypeDefToString(td) : // type is TS.ByReferenceType refType ? TypeToString(refType.ElementType) + "&" : // type is TS.PointerType ptrType ? TypeToString(ptrType.ElementType) + "*" : // type is TS.ArrayType arrType ? TypeToString(arrType.ElementType) + $"[{new string(',', arrType.Dimensions - 1)}]" : // type is paramType ? : // type is TS.ITypeParameter typeParam ? "!" + typeParam.Name : // type is TS.Implementation.NullabilityAnnotatedType decoratedType ? TypeToString(decoratedType.TypeWithoutAnnotation) : // throw new NotImplementedException($"Type reference '{type}' of type '{type.GetType().Name}' is not supported."); public static string TypeToString(TS.IType type) => type is TS.ITypeDefinition td ? TypeDefToString(td) :
public static string TypeDefToString(TS.IType type) => type.GetDefinition().ReflectionName;