2004-09-07 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 7 Sep 2004 17:23:56 +0000 (17:23 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 7 Sep 2004 17:23:56 +0000 (17:23 -0000)
* literal.cs: The type of the null-literal is the null type;  So
we use a placeholder type (literal.cs:System.Null, defined here)
for it.

* expression.cs (Conditional.DoResolve): Remove some old code that
is no longer needed, conversions have been fixed.

svn path=/trunk/mcs/; revision=33529

mcs/mcs/ChangeLog
mcs/mcs/expression.cs
mcs/mcs/literal.cs
mcs/mcs/typemanager.cs

index 687b70e532c58c1df8df66f127e17e2e48581cdb..08c33ea7c0c0d4d5f6553a7d12af046749493b84 100755 (executable)
@@ -1,7 +1,14 @@
 2004-09-07  Miguel de Icaza  <miguel@ximian.com>
 
-       * expression.cs: Return false if we fail to resolve the inner
-       expression. 
+       * literal.cs: The type of the null-literal is the null type;  So
+       we use a placeholder type (literal.cs:System.Null, defined here)
+       for it.
+
+       * expression.cs (Conditional.DoResolve): Remove some old code that
+       is no longer needed, conversions have been fixed.
+
+       (ArrayCreationExpression.DoResolve): Return false if we fail to
+       resolve the inner expression.
 
 2004-09-07  Raja R Harinath  <rharinath@novell.com>
 
index f1e7b37b9dc62d994a77d38b637919936460af56..b172be215e63ce7d5c552e672bcdd077f4254527 100755 (executable)
@@ -3466,14 +3466,6 @@ namespace Mono.CSharp {
                                Type true_type = trueExpr.Type;
                                Type false_type = falseExpr.Type;
 
-                               if (trueExpr is NullLiteral){
-                                       type = false_type;
-                                       return this;
-                               } else if (falseExpr is NullLiteral){
-                                       type = true_type;
-                                       return this;
-                               }
-                               
                                //
                                // First, if an implicit conversion exists from trueExpr
                                // to falseExpr, then the result type is of type falseExpr.Type
index 40f0f27f25e2d1f3fc52230b8feaaba3d526a458..10812524d4eefffaa035f4f44e986532c633b8bd 100755 (executable)
@@ -22,6 +22,18 @@ using System;
 using System.Reflection;
 using System.Reflection.Emit;
 
+//
+// I put System.Null just so we do not have to special case it on 
+// TypeManager.CSharpName
+//
+namespace System {
+       //
+       // Represents the Null Type, just used as a placeholder for the type in NullLiteral
+       //
+       public class Null {
+       }
+}
+       
 namespace Mono.CSharp {
 
        public class NullLiteral : Constant {
@@ -49,7 +61,7 @@ namespace Mono.CSharp {
 
                public override Expression DoResolve (EmitContext ec)
                {
-                       type = TypeManager.object_type;
+                       type = typeof (System.Null); 
                        return this;
                }
 
index e1fa681882ca1c0e06f50ed80e0d63755521dd5f..2ac66bd5d2d0fc12ae75006f07e63acdcd10ffb9 100755 (executable)
@@ -828,7 +828,7 @@ public class TypeManager {
                        @"^System\." +
                        @"(Int32|UInt32|Int16|UInt16|Int64|UInt64|" +
                        @"Single|Double|Char|Decimal|Byte|SByte|Object|" +
-                       @"Boolean|String|Void)" +
+                       @"Boolean|String|Void|Null)" +
                        @"(\W+|\b)", 
                        new MatchEvaluator (CSharpNameMatch));
        }