Author: manjula
Date: 2005-03-29 02:55:38 -0500 (Tue, 29 Mar 2005)
New Revision: 42323

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/assign.cs
Log:
 Disallow New Date assignment with types other than date and object type


Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-03-29 04:15:58 UTC (rev 42322)
+++ trunk/mcs/mbas/ChangeLog    2005-03-29 07:55:38 UTC (rev 42323)
@@ -1,3 +1,6 @@
+2005-03-29 Manjula GHM <[EMAIL PROTECTED]>
+       *assign.cs: Disallow New Date assignment with types other than date and 
object type
+
 2005-03-25:3 Rafael Teixeira <[EMAIL PROTECTED]>
        * AssemblyInfo.cs: Small increment in the version number to publicize 
--codepage support
 

Modified: trunk/mcs/mbas/assign.cs
===================================================================
--- trunk/mcs/mbas/assign.cs    2005-03-29 04:15:58 UTC (rev 42322)
+++ trunk/mcs/mbas/assign.cs    2005-03-29 07:55:38 UTC (rev 42323)
@@ -1,4 +1,4 @@
-//
+
 // assign.cs: Assignments.
 //
 // Authors:
@@ -267,7 +267,6 @@
 
                        Type target_type = target.Type;
                        Type source_type = real_source.Type;
-
                        // If we're an embedded assignment, our parent will 
reuse our source as its
                        // source, it won't read from our target.
                        if (is_embedded)
@@ -347,6 +346,15 @@
                                        source = e.Resolve (ec);
                                        return this;
                                }
+                               if (source_type == TypeManager.date_type && 
(source_type!=target_type)) {
+                                       if( target_type != 
TypeManager.object_type) {
+                                               Report.Error (30311, loc,
+                                                       " Value of type " + 
source_type +
+                                                       " cannot be converted 
to " + target_type);
+                                               return null;
+                                       }
+                                       
+                               }
                                if (target_type.IsValueType) {
                                        New n = (New) source;
                                        n.ValueTypeVariable = target;
@@ -414,7 +422,6 @@
                                Invocation i = (Invocation) target;
                                return i;
                        }
-
                        source = ConvertImplicitRequired (ec, source, 
target_type, loc);
                        if (source == null)
                                return null;

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

Reply via email to