2006-03-22 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Wed, 22 Mar 2006 01:13:56 +0000 (01:13 -0000)
committerMartin Baulig <martin@novell.com>
Wed, 22 Mar 2006 01:13:56 +0000 (01:13 -0000)
* generic.cs
(Nullable.NullableLiteral): Derive from `NullLiteral'.

* convert.cs
(Convert.TypeParameter_to_Null): Create a `Nullable.NullableLiteral'
instead of the normal `NullLiteral'.

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

mcs/gmcs/ChangeLog
mcs/gmcs/convert.cs
mcs/gmcs/generic.cs

index b3380cbc7a60a1d3d809803acc53f648096f1d1f..2f84a974ccde814b1adbe80294e639216ec3f86b 100644 (file)
@@ -1,3 +1,12 @@
+2006-03-22  Martin Baulig  <martin@ximian.com>
+
+       * generic.cs
+       (Nullable.NullableLiteral): Derive from `NullLiteral'.
+
+       * convert.cs
+       (Convert.TypeParameter_to_Null): Create a `Nullable.NullableLiteral'
+       instead of the normal `NullLiteral'.
+
 2006-03-21  Martin Baulig  <martin@ximian.com>
 
        Fix #77583.
index 4f5bb5b1d7d17ac7edebd5a1bc2c7bca41416965..ebd7862465dad7a7fcd1498780c5490f5f3ef669 100644 (file)
@@ -29,8 +29,7 @@ namespace Mono.CSharp {
                //
                public static EmitContext ConstantEC = null;
                
-               static Expression TypeParameter_to_Null (Constant expr, Type target_type,
-                                                        Location loc)
+               static Expression TypeParameter_to_Null (Type target_type, Location loc)
                {
                        if (!TypeParameter_to_Null (target_type)) {
                                Report.Error (403, loc, "Cannot convert null to the type " +
@@ -40,6 +39,7 @@ namespace Mono.CSharp {
                                return null;
                        }
 
+                       Constant expr = new Nullable.NullableLiteral (target_type, loc);
                        return new NullCast (expr, target_type);
                }
 
@@ -1206,7 +1206,7 @@ namespace Mono.CSharp {
 
                        if (expr is NullLiteral) {
                                if (target_type.IsGenericParameter)
-                                       return TypeParameter_to_Null ((Constant) expr, target_type, loc);
+                                       return TypeParameter_to_Null (target_type, loc);
 
                                if (TypeManager.IsNullableType (target_type))
                                        return new Nullable.NullableLiteral (target_type, loc);
index 608f6aae7182036ac434ddffd9dc3795a92f7190..9b53ff9c90d51275a78ecc141f7f59f71f4f678d 100644 (file)
@@ -2824,11 +2824,11 @@ namespace Mono.CSharp {
                        }
                }
 
-               public class NullableLiteral : Expression, IMemoryLocation {
+               public class NullableLiteral : NullLiteral, IMemoryLocation {
                        public NullableLiteral (Type target_type, Location loc)
+                               : base (loc)
                        {
                                this.type = target_type;
-                               this.loc = loc;
 
                                eclass = ExprClass.Value;
                        }