Author: raja
Date: 2005-12-09 07:48:52 -0500 (Fri, 09 Dec 2005)
New Revision: 54159

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/anonymous.cs
   trunk/mcs/gmcs/generic.cs
   trunk/mcs/gmcs/typemanager.cs
Log:
* anonymous.cs (AnonymousMethod.Compatible): Use IsGenericType
instead of IsGenericInstance.
* generic.cs (TypeManager.IsEqual): Likewise.  Delete redundant
code that's now covered by the more general test.
* typemanager.cs (TypeManager.IsPrivateAccessible): Likewise.


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-12-09 11:54:57 UTC (rev 54158)
+++ trunk/mcs/gmcs/ChangeLog    2005-12-09 12:48:52 UTC (rev 54159)
@@ -1,5 +1,11 @@
 2005-12-09  Raja R Harinath  <[EMAIL PROTECTED]>
 
+       * anonymous.cs (AnonymousMethod.Compatible): Use IsGenericType
+       instead of IsGenericInstance.
+       * generic.cs (TypeManager.IsEqual): Likewise.  Delete redundant
+       code that's now covered by the more general test.
+       * typemanager.cs (TypeManager.IsPrivateAccessible): Likewise.
+
        * generic.cs (DropGenericTypeArguments): New.  Captures the common
        pattern: if (t.IsGenericInstance) t = t.GetGenericTypeDefinition ();
        * attribute.cs, class.cs, decl.cs, ecore.cs: Use it.

Modified: trunk/mcs/gmcs/anonymous.cs
===================================================================
--- trunk/mcs/gmcs/anonymous.cs 2005-12-09 11:54:57 UTC (rev 54158)
+++ trunk/mcs/gmcs/anonymous.cs 2005-12-09 12:48:52 UTC (rev 54159)
@@ -233,14 +233,17 @@
                        invoke_mb = (MethodInfo) invoke_mg.Methods [0];
                        ParameterData invoke_pd = TypeManager.GetParameterData 
(invoke_mb);
 
-                       if (delegate_type.IsGenericInstance) {
-                               TypeArguments = TypeManager.GetTypeArguments 
(delegate_type);
+                       if (delegate_type.IsGenericType) {
+                               Type def = 
delegate_type.GetGenericTypeDefinition ();
 
-                               Type def = 
delegate_type.GetGenericTypeDefinition ();
-                               Type[] tparam = TypeManager.GetTypeArguments 
(def);
-                               TypeParameters = new string [tparam.Length];
-                               for (int i = 0; i < tparam.Length; i++)
-                                       TypeParameters [i] = tparam [i].Name;
+                               if (def != delegate_type) {
+                                       Type[] tparam = 
TypeManager.GetTypeArguments (def);
+
+                                       TypeArguments = 
TypeManager.GetTypeArguments (delegate_type);
+                                       TypeParameters = new string 
[tparam.Length];
+                                       for (int i = 0; i < tparam.Length; i++)
+                                               TypeParameters [i] = tparam 
[i].Name;
+                               }
                        }
 
                        if (Parameters == null){                                

Modified: trunk/mcs/gmcs/generic.cs
===================================================================
--- trunk/mcs/gmcs/generic.cs   2005-12-09 11:54:57 UTC (rev 54158)
+++ trunk/mcs/gmcs/generic.cs   2005-12-09 12:48:52 UTC (rev 54159)
@@ -2062,43 +2062,6 @@
                        if (a.Equals (b))
                                return true;
 
-                       if ((a is TypeBuilder) && a.IsGenericTypeDefinition && 
b.IsGenericInstance) {
-                               //
-                               // `a' is a generic type definition's 
TypeBuilder and `b' is a
-                               // generic instance of the same type.
-                               //
-                               // Example:
-                               //
-                               // class Stack<T>
-                               // {
-                               //     void Test (Stack<T> stack) { }
-                               // }
-                               //
-                               // The first argument of `Test' will be the 
generic instance
-                               // "Stack<!0>" - which is the same type than 
the "Stack" TypeBuilder.
-                               //
-                               //
-                               // We hit this via Closure.Filter() for 
gen-82.cs.
-                               //
-                               if (a != b.GetGenericTypeDefinition ())
-                                       return false;
-
-                               Type[] aparams = a.GetGenericArguments ();
-                               Type[] bparams = b.GetGenericArguments ();
-
-                               if (aparams.Length != bparams.Length)
-                                       return false;
-
-                               for (int i = 0; i < aparams.Length; i++)
-                                       if (!IsEqual (aparams [i], bparams [i]))
-                                               return false;
-
-                               return true;
-                       }
-
-                       if ((b is TypeBuilder) && b.IsGenericTypeDefinition && 
a.IsGenericInstance)
-                               return IsEqual (b, a);
-
                        if (a.IsGenericParameter && b.IsGenericParameter) {
                                if (a.DeclaringMethod != b.DeclaringMethod &&
                                    (a.DeclaringMethod == null || 
b.DeclaringMethod == null))
@@ -2112,7 +2075,7 @@
                                return IsEqual (a.GetElementType (), 
b.GetElementType ());
                        }
 
-                       if (a.IsGenericInstance && b.IsGenericInstance) {
+                       if (a.IsGenericType && b.IsGenericType) {
                                if (a.GetGenericTypeDefinition () != 
b.GetGenericTypeDefinition ())
                                        return false;
 

Modified: trunk/mcs/gmcs/typemanager.cs
===================================================================
--- trunk/mcs/gmcs/typemanager.cs       2005-12-09 11:54:57 UTC (rev 54158)
+++ trunk/mcs/gmcs/typemanager.cs       2005-12-09 12:48:52 UTC (rev 54159)
@@ -1573,31 +1573,6 @@
        {
                if (type.Equals (parent))
                        return true;
-
-               if ((type is TypeBuilder) && type.IsGenericTypeDefinition && 
parent.IsGenericInstance) {
-                       //
-                       // `a' is a generic type definition's TypeBuilder and 
`b' is a
-                       // generic instance of the same type.
-                       //
-                       // Example:
-                       //
-                       // class Stack<T>
-                       // {
-                       //     void Test (Stack<T> stack) { }
-                       // }
-                       //
-                       // The first argument of `Test' will be the generic 
instance
-                       // "Stack<!0>" - which is the same type than the 
"Stack" TypeBuilder.
-                       //
-                       //
-                       // We hit this via Closure.Filter() for gen-82.cs.
-                       //
-                       if (type != parent.GetGenericTypeDefinition ())
-                               return false;
-
-                       return true;
-               }
-
                return DropGenericTypeArguments (type) == 
DropGenericTypeArguments (parent);
        }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to