Author: martin
Date: 2005-03-13 02:46:28 -0500 (Sun, 13 Mar 2005)
New Revision: 41748

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/expression.cs
Log:
2005-03-13  Martin Baulig  <[EMAIL PROTECTED]>

        * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
        comparing arbitrary types with the null literal.



Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-03-13 07:13:19 UTC (rev 41747)
+++ trunk/mcs/gmcs/ChangeLog    2005-03-13 07:46:28 UTC (rev 41748)
@@ -1,5 +1,10 @@
 2005-03-13  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
+       comparing arbitrary types with the null literal.
+
+2005-03-13  Martin Baulig  <[EMAIL PROTECTED]>
+
        * generic.cs (Nullable.LiftedBinaryOperator): Add support for the
        boolean operators '&&', '||', '&' and '|'.
        (Nullable.OperatorTrueOrFalse): New public class.

Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs        2005-03-13 07:13:19 UTC (rev 41747)
+++ trunk/mcs/gmcs/expression.cs        2005-03-13 07:46:28 UTC (rev 41748)
@@ -2396,6 +2396,15 @@
                                        return this;
                                }
 
+                               bool left_is_null = left is NullLiteral;
+                               bool right_is_null = right is NullLiteral;
+                               if (left_is_null || right_is_null) {
+                                       if (oper == Operator.Equality)
+                                               return new BoolLiteral 
(left_is_null == right_is_null);
+                                       else
+                                               return new BoolLiteral 
(left_is_null != right_is_null);
+                               }
+
                                //
                                // operator != (object a, object b)
                                // operator == (object a, object b)

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

Reply via email to