Author: marek
Date: 2008-01-03 09:42:17 -0500 (Thu, 03 Jan 2008)
New Revision: 92179

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/class.cs
   trunk/mcs/mcs/generic.cs
   trunk/mcs/mcs/typemanager.cs
Log:
2008-01-03  Marek Safar  <[EMAIL PROTECTED]>

        A fix for bug #351047
        * generic.cs, typemanager.cs, class.cs: New IsReferenceType helper 
method.
        


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2008-01-03 14:14:56 UTC (rev 92178)
+++ trunk/mcs/mcs/ChangeLog     2008-01-03 14:42:17 UTC (rev 92179)
@@ -1,5 +1,10 @@
 2008-01-03  Marek Safar  <[EMAIL PROTECTED]>
 
+       A fix for bug #351047
+       * generic.cs, typemanager.cs, class.cs: New IsReferenceType helper 
method.
+       
+2008-01-03  Marek Safar  <[EMAIL PROTECTED]>
+
        A fix for bug #351257
        * cs-tokenizer.cs: Advance line number for '\r' correctly.
        

Modified: trunk/mcs/mcs/class.cs
===================================================================
--- trunk/mcs/mcs/class.cs      2008-01-03 14:14:56 UTC (rev 92178)
+++ trunk/mcs/mcs/class.cs      2008-01-03 14:42:17 UTC (rev 92179)
@@ -6034,17 +6034,7 @@
 
                bool CanBeVolatile ()
                {
-#if GMCS_SOURCE                        
-                       if (TypeManager.IsGenericParameter (MemberType)) {
-                               GenericConstraints constraints = 
TypeManager.GetTypeParameterConstraints (MemberType);
-                               if (constraints == null)
-                                       return false;
-
-                               return constraints.IsReferenceType;
-                       }
-#endif                 
-
-                       if (!MemberType.IsValueType)
+                       if (TypeManager.IsReferenceType (MemberType))
                                return true;
 
                        if (MemberType.IsEnum)

Modified: trunk/mcs/mcs/generic.cs
===================================================================
--- trunk/mcs/mcs/generic.cs    2008-01-03 14:14:56 UTC (rev 92178)
+++ trunk/mcs/mcs/generic.cs    2008-01-03 14:42:17 UTC (rev 92179)
@@ -3870,11 +3870,9 @@
                                                type = expr.Type;
                                                return this;
                                        }
-                               } else {
-                                       if (left.IsNull || ltype.IsValueType) {
-                                               
Binary.Error_OperatorCannotBeApplied (loc, "??", ltype, rtype);
-                                               return null;
-                                       }
+                               } else if (!TypeManager.IsReferenceType 
(ltype)) {
+                                       Binary.Error_OperatorCannotBeApplied 
(loc, "??", ltype, rtype);
+                                       return null;
                                }
 
                                expr = Convert.ImplicitConversion (ec, right, 
ltype, loc);

Modified: trunk/mcs/mcs/typemanager.cs
===================================================================
--- trunk/mcs/mcs/typemanager.cs        2008-01-03 14:14:56 UTC (rev 92178)
+++ trunk/mcs/mcs/typemanager.cs        2008-01-03 14:42:17 UTC (rev 92179)
@@ -1735,6 +1735,22 @@
 
                return retval;
        }
+                       
+       public static bool IsReferenceType (Type t)
+       {
+               if (TypeManager.IsGenericParameter (t)) {
+                       GenericConstraints constraints = 
TypeManager.GetTypeParameterConstraints (t);
+                       if (constraints == null)
+                               return false;
+
+                       return constraints.IsReferenceType;
+               }
+
+               if (t == TypeManager.null_type)
+                       return false;
+
+               return !t.IsValueType;
+       }                       
                
        public static bool IsValueType (Type t)
        {

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

Reply via email to