Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2005-12-15 14:42:40 +0300
committerRaja R Harinath <harinath@hurrynot.org>2005-12-15 14:42:40 +0300
commitec9ed5fb110a3c2967cc4f5103dd4a36874d70d8 (patch)
tree680a50e3fd28d4002b4ed2e587923d69e54d2bb7 /mcs/gmcs/typemanager.cs
parentafaff9b06f8af25ecc3664f6664057705f62cf83 (diff)
* typemanager.cs (TypeManager.GetFullName): Rewrite to handle nested types.
svn path=/trunk/mcs/; revision=54445
Diffstat (limited to 'mcs/gmcs/typemanager.cs')
-rw-r--r--mcs/gmcs/typemanager.cs52
1 files changed, 40 insertions, 12 deletions
diff --git a/mcs/gmcs/typemanager.cs b/mcs/gmcs/typemanager.cs
index 68cee480ec7..fe959f8c179 100644
--- a/mcs/gmcs/typemanager.cs
+++ b/mcs/gmcs/typemanager.cs
@@ -653,25 +653,53 @@ public partial class TypeManager {
: CSharpName (mi.DeclaringType) + '.' + mi.Name;
}
- public static string GetFullName (Type t)
+ private static int GetFullName (Type t, StringBuilder sb)
{
- if (t.IsGenericParameter)
- return t.Name;
+ int pos = 0;
+
+ if (!t.IsGenericType) {
+ sb.Append (t.FullName);
+ return 0;
+ }
- StringBuilder sb = new StringBuilder (RemoveGenericArity (t.FullName));
+ if (t.DeclaringType != null) {
+ pos = GetFullName (t.DeclaringType, sb);
+ sb.Append ('.');
+ sb.Append (RemoveGenericArity (t.Name));
+ } else {
+ sb.Append (RemoveGenericArity (t.FullName));
+ }
Type[] this_args = GetTypeArguments (t);
- if (this_args.Length > 0) {
- sb.Append ('<');
- for (int i = 0; i < this_args.Length; i++) {
- if (i > 0)
- sb.Append (',');
- sb.Append (CSharpName (this_args[i]));
- }
- sb.Append ('>');
+ if (this_args.Length < pos)
+ throw new InternalErrorException (
+ "Enclosing class " + t.DeclaringType + " has more type arguments than " + t);
+ if (this_args.Length == pos)
+ return pos;
+
+ sb.Append ('<');
+ for (;;) {
+ sb.Append (CSharpName (this_args [pos++]));
+ if (pos == this_args.Length)
+ break;
+ sb.Append (',');
}
+ sb.Append ('>');
+ return pos;
+ }
+ public static string GetFullName (Type t)
+ {
+ if (t.IsGenericParameter)
+ return t.Name;
+ if (!t.IsGenericType)
+ return t.FullName;
+
+ StringBuilder sb = new StringBuilder ();
+ int pos = GetFullName (t, sb);
+ if (pos <= 0)
+ throw new InternalErrorException ("Generic Type " + t + " doesn't have type arguments");
return sb.ToString ();
}