diff options
author | Martin Baulig <martin@novell.com> | 2005-06-13 18:13:27 +0400 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2005-06-13 18:13:27 +0400 |
commit | 2acc83f0dea2a8c5151b478b1547ed1ea2b9cb0e (patch) | |
tree | 00aed871b85997e966828edf774848187500d224 /mcs | |
parent | 2c47e928e357b86ed318d761aef6445babe583ff (diff) |
Mon Jun 13 16:57:38 CEST 2005
svn path=/trunk/mcs/; revision=45870
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/gmcs/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/gmcs/ecore.cs | 2 | ||||
-rw-r--r-- | mcs/gmcs/expression.cs | 2 | ||||
-rw-r--r-- | mcs/gmcs/typemanager.cs | 39 |
4 files changed, 15 insertions, 34 deletions
diff --git a/mcs/gmcs/ChangeLog b/mcs/gmcs/ChangeLog index 77e397d9f83..d35e0719e91 100644 --- a/mcs/gmcs/ChangeLog +++ b/mcs/gmcs/ChangeLog @@ -1,9 +1,3 @@ -2005-06-13 Martin Baulig <martin@ximian.com> - - * typemanager.cs (TypeManager.GetTypeName): New public function; - use this everywhere instead of accessing `Type.FullName' directly; - this is neccessary since `Type.FullName' is broken in .NET 2.x. - 2005-06-09 Martin Baulig <martin@ximian.com> * delegate.cs (Delegate.VerifyMethod): Added diff --git a/mcs/gmcs/ecore.cs b/mcs/gmcs/ecore.cs index 3518f56a14e..07f8fc38551 100644 --- a/mcs/gmcs/ecore.cs +++ b/mcs/gmcs/ecore.cs @@ -2469,7 +2469,7 @@ namespace Mono.CSharp { public override string FullName { get { - return TypeManager.GetTypeName (Type); + return Type.FullName != null ? Type.FullName : Type.Name; } } } diff --git a/mcs/gmcs/expression.cs b/mcs/gmcs/expression.cs index 7703587b363..580f90dfa3e 100644 --- a/mcs/gmcs/expression.cs +++ b/mcs/gmcs/expression.cs @@ -8857,7 +8857,7 @@ namespace Mono.CSharp { public override string FullName { get { - return TypeManager.GetTypeName (type); + return type.FullName; } } } diff --git a/mcs/gmcs/typemanager.cs b/mcs/gmcs/typemanager.cs index 655e968880c..c8125b928a6 100644 --- a/mcs/gmcs/typemanager.cs +++ b/mcs/gmcs/typemanager.cs @@ -715,7 +715,7 @@ public partial class TypeManager { { object ret = null; if (!type_hash.Lookup (t, name, out ret)) { - string lookup = GetTypeName (t) + "+" + name; + string lookup = t.FullName + "+" + name; ret = t.Module.GetType (lookup); type_hash.Insert (t, name, ret); } @@ -852,9 +852,10 @@ public partial class TypeManager { /// </summary> static public string CSharpName (Type t) { - string name = GetTypeName (t); + if (t.FullName == null) + return t.Name; - return Regex.Replace (name, + return Regex.Replace (t.FullName, @"^System\." + @"(Int32|UInt32|Int16|UInt16|Int64|UInt64|" + @"Single|Double|Char|Decimal|Byte|SByte|Object|" + @@ -897,7 +898,7 @@ public partial class TypeManager { // Unfortunately, there's no dynamic dispatch on the arguments of a function. return (mi is MethodBase) ? GetFullNameSignature (mi as MethodBase) - : GetTypeName (mi.DeclaringType).Replace ('+', '.') + '.' + mi.Name; + : mi.DeclaringType.FullName.Replace ('+', '.') + '.' + mi.Name; } static public string GetFullNameSignature (MethodBase mb) @@ -915,11 +916,10 @@ public partial class TypeManager { name = "this"; } - return GetTypeName (mb.DeclaringType).Replace ('+', '.') + '.' + name; + return mb.DeclaringType.FullName.Replace ('+', '.') + '.' + name; } - private static void GetFullName_recursed (StringBuilder sb, Type t, bool recursed, - bool include_generic) + private static void GetFullName_recursed (StringBuilder sb, Type t, bool recursed) { if (t.IsGenericParameter) { sb.Append (t.Name); @@ -927,7 +927,7 @@ public partial class TypeManager { } if (t.DeclaringType != null) { - GetFullName_recursed (sb, t.DeclaringType, true, include_generic); + GetFullName_recursed (sb, t.DeclaringType, true); sb.Append ("."); } @@ -939,11 +939,6 @@ public partial class TypeManager { } } - if (!include_generic) { - sb.Append (t.Name); - return; - } - sb.Append (SimpleName.RemoveGenericArity (t.Name)); Type[] args = GetTypeArguments (t); @@ -952,7 +947,7 @@ public partial class TypeManager { for (int i = 0; i < args.Length; i++) { if (i > 0) sb.Append (","); - GetFullName_recursed (sb, args [i], false, true); + sb.Append (GetFullName (args [i])); } sb.Append (">"); } @@ -961,15 +956,7 @@ public partial class TypeManager { static public string GetFullName (Type t) { StringBuilder sb = new StringBuilder (); - GetFullName_recursed (sb, t, false, true); - return sb.ToString (); - } - - static public string GetTypeName (Type t) - { - StringBuilder sb = new StringBuilder (); - GetFullName_recursed (sb, t, false, false); - Report.Debug (64, "GET TYPE NAME", t, sb.ToString ()); + GetFullName_recursed (sb, t, false); return sb.ToString (); } @@ -2891,9 +2878,9 @@ public partial class TypeManager { // type names // if (invocation_type != null){ - string invocation_name = GetTypeName (invocation_type); + string invocation_name = invocation_type.FullName; if ((invocation_name != null) && (invocation_name.IndexOf ('+') != -1)){ - string container = GetTypeName (queried_type) + "+"; + string container = queried_type.FullName + "+"; int container_length = container.Length; if (invocation_name.Length > container_length){ @@ -3183,7 +3170,7 @@ public sealed class TypeHandle : IMemberContainer { private TypeHandle (Type type) { this.type = type; - full_name = TypeManager.GetTypeName (type); + full_name = type.FullName != null ? type.FullName : type.Name; if (type.BaseType != null) { base_cache = TypeManager.LookupMemberCache (type.BaseType); BaseType = base_cache.Container; |