return false;
if (Expr.Type != ec.ReturnType) {
- Expr = Convert.ImplicitConversionRequired (
+ Expr = Convert.WideningConversionRequired (
ec, Expr, ec.ReturnType, loc);
if (Expr == null)
return false;
label.AddUsageVector (ec.CurrentBranching.CurrentUsageVector);
ec.CurrentBranching.CurrentUsageVector.Goto ();
+ label.AddReference ();
return true;
}
{
ec.CurrentBranching.Label (vectors);
- referenced = true;
return true;
}
LabelTarget (ec);
ec.ig.MarkLabel (label);
}
+
+ public void AddReference ()
+ {
+ referenced = true;
+ }
}
// conversions, we have to report an error
//
Expression converted = null;
- foreach (Type tt in allowed_types){
- Expression e;
-
- 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;
-
- if (ue.Source != Expr)
- e = null;
- }
+ //
+ // VB.NET has no notion of User defined conversions
+ //
+
+// foreach (Type tt in allowed_types){
+// Expression 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;
- }
- }
+// 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;
+
+// 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;
+// }
+// }
return converted;
}
//
ArrayPtr array_ptr = new ArrayPtr (e, loc);
- Expression converted = Convert.ImplicitConversionRequired (
+ Expression converted = Convert.WideningConversionRequired (
ec, array_ptr, vi.VariableType, loc);
if (converted == null)
return false;
// For other cases, flag a `this is already fixed expression'
//
if (e is LocalVariableReference || e is ParameterReference ||
- Convert.ImplicitConversionExists (ec, e, vi.VariableType)){
+ Convert.WideningConversionExists (ec, e, vi.VariableType)){
Report.Error (245, loc, "right hand expression is already fixed, no need to use fixed statement ");
return false;
ig.Emit (OpCodes.Stloc, pinned_string);
Expression sptr = new StringPtr (pinned_string, loc);
- Expression converted = Convert.ImplicitConversionRequired (
+ Expression converted = Convert.WideningConversionRequired (
ec, sptr, vi.VariableType, loc);
if (converted == null)
continue;
}
- converted_vars [i] = Convert.ImplicitConversionRequired (
+ converted_vars [i] = Convert.WideningConversionRequired (
ec, var, TypeManager.idisposable_type, loc);
if (converted_vars [i] == null)
bool ResolveExpression (EmitContext ec)
{
if (!TypeManager.ImplementsInterface (expr_type, TypeManager.idisposable_type)){
- conv = Convert.ImplicitConversionRequired (
+ conv = Convert.WideningConversionRequired (
ec, expr, TypeManager.idisposable_type, loc);
if (conv == null)
// Although it is not as important in this case, as the type
// will not likely be object (what the enumerator will return).
//
- conv = Convert.ExplicitConversion (ec, empty, var_type, loc);
+ conv = Convert.WideningAndNarrowingConversion (ec, empty, var_type, loc);
if (conv == null)
ok = false;