+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.
//
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 " +
return null;
}
+ Constant expr = new Nullable.NullableLiteral (target_type, loc);
return new NullCast (expr, target_type);
}
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);
}
}
- 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;
}