Author: jambunathan
Date: 2005-02-27 16:29:04 -0500 (Sun, 27 Feb 2005)
New Revision: 41265
Modified:
trunk/mcs/bmcs/ChangeLog
trunk/mcs/bmcs/convert.cs
trunk/mcs/bmcs/expression.cs
trunk/mcs/bmcs/statement.cs
Log:
VB.NET has no notion of User defined conversions. Assuming that
UserDefinedConversion () returns null, propagated the resulting changes
upstream.
Modified: trunk/mcs/bmcs/ChangeLog
===================================================================
--- trunk/mcs/bmcs/ChangeLog 2005-02-27 19:01:32 UTC (rev 41264)
+++ trunk/mcs/bmcs/ChangeLog 2005-02-27 21:29:04 UTC (rev 41265)
@@ -1,3 +1,11 @@
+2005-02-28 Jambunathan K <[EMAIL PROTECTED]>
+
+ * convert.cs :
+ * expression.cs :
+ * statement.cs: VB.NET has no notion of User defined
+ conversions. Assuming that UserDefinedConversion() returns null,
+ propagated the resulting changes upstream.
+
2005-02-02 Martin Baulig <[EMAIL PROTECTED]>
* delegate.cs (Delegate.DefineType): Report an internal error if
Modified: trunk/mcs/bmcs/convert.cs
===================================================================
--- trunk/mcs/bmcs/convert.cs 2005-02-27 19:01:32 UTC (rev 41264)
+++ trunk/mcs/bmcs/convert.cs 2005-02-27 21:29:04 UTC (rev 41265)
@@ -554,21 +554,29 @@
if (ImplicitStandardConversionExists (ec, expr,
target_type))
return true;
- Expression dummy = ImplicitUserConversion (ec, expr,
target_type, Location.Null);
+ //
+ // VB.NET has no notion of User defined conversions
+ //
- if (dummy != null)
- return true;
+// Expression dummy = ImplicitUserConversion (ec, expr,
target_type, Location.Null);
+// if (dummy != null)
+// return true;
+
return false;
}
- public static bool ImplicitUserConversionExists (EmitContext
ec, Type source, Type target)
- {
- Expression dummy = ImplicitUserConversion (
- ec, new EmptyExpression (source), target,
Location.Null);
- return dummy != null;
- }
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+// public static bool ImplicitUserConversionExists (EmitContext
ec, Type source, Type target)
+// {
+// Expression dummy = ImplicitUserConversion (
+// ec, new EmptyExpression (source), target,
Location.Null);
+// return dummy != null;
+// }
+
/// <summary>
/// Determines if a standard implicit conversion exists from
/// expr_type to target_type
@@ -1018,21 +1026,31 @@
/// <summary>
/// User-defined Implicit conversions
/// </summary>
- static public Expression ImplicitUserConversion (EmitContext
ec, Expression source,
- Type target,
Location loc)
- {
- return UserDefinedConversion (ec, source, target, loc,
false);
- }
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+
+// static public Expression ImplicitUserConversion (EmitContext
ec, Expression source,
+// Type target,
Location loc)
+// {
+// return UserDefinedConversion (ec, source, target, loc,
false);
+// }
+
/// <summary>
/// User-defined Explicit conversions
/// </summary>
- static public Expression ExplicitUserConversion (EmitContext
ec, Expression source,
- Type target,
Location loc)
- {
- return UserDefinedConversion (ec, source, target, loc,
true);
- }
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+
+// static public Expression ExplicitUserConversion (EmitContext
ec, Expression source,
+// Type target,
Location loc)
+// {
+// return UserDefinedConversion (ec, source, target, loc,
true);
+// }
+
static DoubleHash explicit_conv = new DoubleHash (100);
static DoubleHash implicit_conv = new DoubleHash (100);
/// <summary>
@@ -1112,6 +1130,10 @@
/// <summary>
/// User-defined conversions
/// </summary>
+
+ //
+ // VB.NET has no notion of User defined conversions. This
method is not used.
+ //
static public Expression UserDefinedConversion (EmitContext ec,
Expression source,
Type target,
Location loc,
bool
look_for_explicit)
@@ -1195,10 +1217,14 @@
if (e != null)
return e;
- e = ImplicitUserConversion (ec, expr, target_type, loc);
- if (e != null)
- return e;
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+// e = ImplicitUserConversion (ec, expr, target_type, loc);
+// if (e != null)
+// return e;
+
return null;
}
@@ -1984,10 +2010,14 @@
}
}
- ne = ExplicitUserConversion (ec, expr, target_type,
loc);
- if (ne != null)
- return ne;
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+// ne = ExplicitUserConversion (ec, expr, target_type,
loc);
+// if (ne != null)
+// return ne;
+
if (expr is NullLiteral){
Report.Error (37, loc, "Cannot convert null to
value type `" +
TypeManager.CSharpName
(target_type) + "'");
Modified: trunk/mcs/bmcs/expression.cs
===================================================================
--- trunk/mcs/bmcs/expression.cs 2005-02-27 19:01:32 UTC (rev 41264)
+++ trunk/mcs/bmcs/expression.cs 2005-02-27 21:29:04 UTC (rev 41265)
@@ -1989,12 +1989,18 @@
if (!check_user_conversions)
return false;
- if (Convert.ImplicitUserConversionExists (ec, l, t))
- return true;
- else if (Convert.ImplicitUserConversionExists (ec, r,
t))
- return true;
- else
- return false;
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+
+// if (Convert.ImplicitUserConversionExists (ec, l, t))
+// return true;
+// else if (Convert.ImplicitUserConversionExists (ec, r,
t))
+// return true;
+// else
+// return false;
+
+ return false;
}
//
Modified: trunk/mcs/bmcs/statement.cs
===================================================================
--- trunk/mcs/bmcs/statement.cs 2005-02-27 19:01:32 UTC (rev 41264)
+++ trunk/mcs/bmcs/statement.cs 2005-02-27 21:29:04 UTC (rev 41265)
@@ -2390,34 +2390,39 @@
// conversions, we have to report an error
//
Expression converted = null;
- foreach (Type tt in allowed_types){
- Expression e;
+
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+
+// foreach (Type tt in allowed_types){
+// Expression e;
- e = Convert.ImplicitUserConversion (ec, Expr,
tt, loc);
- if (e == null)
- continue;
+// e = Convert.ImplicitUserConversion (ec, Expr,
tt, loc);
+// if (e == null)
+// continue;
- //
- // Ignore over-worked ImplicitUserConversions
that do
- // an implicit conversion in addition to the
user conversion.
- //
- if (e is UserCast){
- UserCast ue = e as UserCast;
+// //
+// // Ignore over-worked ImplicitUserConversions
that do
+// // an implicit conversion in addition to the
user conversion.
+// //
+// if (e is UserCast){
+// UserCast ue = e as UserCast;
- if (ue.Source != Expr)
- e = null;
- }
+// if (ue.Source != Expr)
+// e = null;
+// }
- if (converted != null){
- Report.ExtraInformation (
- loc,
- String.Format ("reason: more
than one conversion to an integral type exist for type {0}",
-
TypeManager.CSharpName (Expr.Type)));
- return null;
- } else {
- converted = e;
- }
- }
+// if (converted != null){
+// Report.ExtraInformation (
+// loc,
+// String.Format ("reason: more
than one conversion to an integral type exist for type {0}",
+//
TypeManager.CSharpName (Expr.Type)));
+// return null;
+// } else {
+// converted = e;
+// }
+// }
return converted;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches