Author: jambunathan
Date: 2005-02-27 17:12:07 -0500 (Sun, 27 Feb 2005)
New Revision: 41266
Modified:
trunk/mcs/bmcs/ChangeLog
trunk/mcs/bmcs/assign.cs
trunk/mcs/bmcs/attribute.cs
trunk/mcs/bmcs/cfold.cs
trunk/mcs/bmcs/const.cs
trunk/mcs/bmcs/constant.cs
trunk/mcs/bmcs/convert.cs
trunk/mcs/bmcs/ecore.cs
trunk/mcs/bmcs/enum.cs
trunk/mcs/bmcs/expression.cs
trunk/mcs/bmcs/generic.cs
trunk/mcs/bmcs/iterators.cs
trunk/mcs/bmcs/statement.cs
Log:
Broadly, what C# spec terms as "Implicit" & "Explicit", VB.NET spec
terms as "Widening" & "Narrowing" respectively. So renamed exisiting
methods to reflect the VB.NET nomenclature. These are just first
renamings.
Modified: trunk/mcs/bmcs/ChangeLog
===================================================================
--- trunk/mcs/bmcs/ChangeLog 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/ChangeLog 2005-02-27 22:12:07 UTC (rev 41266)
@@ -1,5 +1,14 @@
2005-02-28 Jambunathan K <[EMAIL PROTECTED]>
+ * assign.cs, attribute.cs, cfold.cs, const.cs, constant.cs,
+ * convert.cs, ecore.cs, enum.cs, expression.cs, generic.cs,
+ * iterator.cs, statement.cs : Broadly, what C# spec terms as
+ "Implicit" & "Explicit", VB.NET spec terms as "Widening" &
+ "Narrowing" respectively. So renamed exisiting methods to reflect
+ the VB.NET nomenclature. These are just first renamings.
+
+2005-02-28 Jambunathan K <[EMAIL PROTECTED]>
+
* convert.cs :
* expression.cs :
* statement.cs: VB.NET has no notion of User defined
Modified: trunk/mcs/bmcs/assign.cs
===================================================================
--- trunk/mcs/bmcs/assign.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/assign.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -449,9 +449,9 @@
// target_type
//
- source = Convert.ExplicitConversion
(ec, source, target_type, loc);
+ source =
Convert.WideningAndNarrowingConversion (ec, source, target_type, loc);
if (source == null){
-
Convert.Error_CannotImplicitConversion (loc, source_type, target_type);
+
Convert.Error_CannotWideningConversion (loc, source_type, target_type);
return null;
}
@@ -459,7 +459,7 @@
// 2. and the original right side is
implicitly convertible to
// the type of target
//
- if
(Convert.ImplicitStandardConversionExists (ec, a.original_source, target_type))
+ if
(Convert.WideningStandardConversionExists (ec, a.original_source, target_type))
return this;
//
@@ -470,12 +470,12 @@
(b.Oper ==
Binary.Operator.LeftShift || b.Oper == Binary.Operator.RightShift))
return this;
- Convert.Error_CannotImplicitConversion
(loc, a.original_source.Type, target_type);
+ Convert.Error_CannotWideningConversion
(loc, a.original_source.Type, target_type);
return null;
}
}
- source = Convert.ImplicitConversionRequired (ec,
source, target_type, loc);
+ source = Convert.WideningConversionRequired (ec,
source, target_type, loc);
if (source == null)
return null;
Modified: trunk/mcs/bmcs/attribute.cs
===================================================================
--- trunk/mcs/bmcs/attribute.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/attribute.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -1012,10 +1012,10 @@
public object GetValue (EmitContext ec, Constant c, Type target)
{
- if (Convert.ImplicitConversionExists (ec, c, target))
+ if (Convert.WideningConversionExists (ec, c, target))
return c.GetValue ();
- Convert.Error_CannotImplicitConversion (Location,
c.Type, target);
+ Convert.Error_CannotWideningConversion (Location,
c.Type, target);
return null;
}
Modified: trunk/mcs/bmcs/cfold.cs
===================================================================
--- trunk/mcs/bmcs/cfold.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/cfold.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -160,8 +160,8 @@
(oper != Binary.Operator.Subtraction));
if (need_check &&
- !Convert.ImplicitConversionExists (ec,
match, other.Type)) {
- Convert.Error_CannotImplicitConversion
(loc, match.Type, other.Type);
+ !Convert.WideningConversionExists (ec,
match, other.Type)) {
+ Convert.Error_CannotWideningConversion
(loc, match.Type, other.Type);
left = null;
right = null;
return;
Modified: trunk/mcs/bmcs/const.cs
===================================================================
--- trunk/mcs/bmcs/const.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/const.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -114,13 +114,13 @@
if (expr.Type == TypeManager.null_type &&
!type.IsValueType && !TypeManager.IsEnumType (type))
return NullLiteral.Null;
- if (!Convert.ImplicitStandardConversionExists
(Convert.ConstantEC, expr, type)){
- Convert.Error_CannotImplicitConversion (loc,
expr.Type, type);
+ if (!Convert.WideningStandardConversionExists
(Convert.ConstantEC, expr, type)){
+ Convert.Error_CannotWideningConversion (loc,
expr.Type, type);
return null;
}
// Special-case: The 0 literal can be converted to an
enum value,
- // and ImplicitStandardConversionExists will return
true in that case.
+ // and WideningStandardConversionExists will return
true in that case.
if (expr.Type == TypeManager.int32_type &&
TypeManager.IsEnumType (type)){
if (expr is IntLiteral && ((IntLiteral)
expr).Value == 0)
return new EnumConstant (expr, type);
@@ -128,11 +128,11 @@
object constant_value = TypeManager.ChangeType
(expr.GetValue (), type, out fail);
if (fail){
- Convert.Error_CannotImplicitConversion (loc,
expr.Type, type);
+ Convert.Error_CannotWideningConversion (loc,
expr.Type, type);
//
// We should always catch the error before this
is ever
- // reached, by calling
Convert.ImplicitStandardConversionExists
+ // reached, by calling
Convert.WideningStandardConversionExists
//
throw new Exception (
String.Format
("LookupConstantValue: This should never be reached {0} {1}", expr.Type, type));
Modified: trunk/mcs/bmcs/constant.cs
===================================================================
--- trunk/mcs/bmcs/constant.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/constant.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -62,7 +62,7 @@
DoubleConstant c = ConvertToDouble ();
if (c == null)
- Convert.Error_CannotImplicitConversion (loc,
Type, TypeManager.double_type);
+ Convert.Error_CannotWideningConversion (loc,
Type, TypeManager.double_type);
return c;
}
@@ -72,7 +72,7 @@
FloatConstant c = ConvertToFloat ();
if (c == null)
- Convert.Error_CannotImplicitConversion (loc,
Type, TypeManager.float_type);
+ Convert.Error_CannotWideningConversion (loc,
Type, TypeManager.float_type);
return c;
}
@@ -82,7 +82,7 @@
ULongConstant c = ConvertToULong ();
if (c == null)
- Convert.Error_CannotImplicitConversion (loc,
Type, TypeManager.uint64_type);
+ Convert.Error_CannotWideningConversion (loc,
Type, TypeManager.uint64_type);
return c;
}
@@ -92,7 +92,7 @@
LongConstant c = ConvertToLong ();
if (c == null)
- Convert.Error_CannotImplicitConversion (loc,
Type, TypeManager.int64_type);
+ Convert.Error_CannotWideningConversion (loc,
Type, TypeManager.int64_type);
return c;
}
@@ -102,7 +102,7 @@
UIntConstant c = ConvertToUInt ();
if (c == null)
- Convert.Error_CannotImplicitConversion (loc,
Type, TypeManager.uint32_type);
+ Convert.Error_CannotWideningConversion (loc,
Type, TypeManager.uint32_type);
return c;
}
@@ -112,7 +112,7 @@
IntConstant c = ConvertToInt ();
if (c == null)
- Convert.Error_CannotImplicitConversion (loc,
Type, TypeManager.int32_type);
+ Convert.Error_CannotWideningConversion (loc,
Type, TypeManager.int32_type);
return c;
}
Modified: trunk/mcs/bmcs/convert.cs
===================================================================
--- trunk/mcs/bmcs/convert.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/convert.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -138,7 +138,7 @@
}
static EmptyExpression MyEmptyExpr;
- static public Expression ImplicitReferenceConversion
(EmitContext ec, Expression expr, Type target_type)
+ static public Expression WideningReferenceConversion
(EmitContext ec, Expression expr, Type target_type)
{
Type expr_type = expr.Type;
@@ -193,7 +193,7 @@
return new EmptyCast (expr, target_type);
}
- // This code is kind of mirrored inside
ImplicitStandardConversionExists
+ // This code is kind of mirrored inside
WideningStandardConversionExists
// with the small distinction that we only probe there
//
// Always ensure that the code here and there is in sync
@@ -248,7 +248,7 @@
Type target_element_type =
TypeManager.GetElementType (target_type);
if (!expr_element_type.IsValueType &&
!target_element_type.IsValueType)
- if
(ImplicitStandardConversionExists (ConstantEC, MyEmptyExpr,
+ if
(WideningStandardConversionExists (ConstantEC, MyEmptyExpr,
target_element_type))
return new EmptyCast
(expr, target_type);
}
@@ -280,7 +280,7 @@
// Tests whether an implicit reference conversion exists
between expr_type
// and target_type
//
- public static bool ImplicitReferenceConversionExists
(EmitContext ec, Expression expr, Type target_type)
+ public static bool WideningReferenceConversionExists
(EmitContext ec, Expression expr, Type target_type)
{
Type expr_type = expr.Type;
@@ -301,7 +301,7 @@
return true;
// Please remember that all code below actually comes
- // from ImplicitReferenceConversion so make sure code
remains in sync
+ // from WideningReferenceConversion so make sure code
remains in sync
// from any class-type S to any interface-type T.
if (target_type.IsInterface) {
@@ -337,7 +337,7 @@
Type target_element_type =
TypeManager.GetElementType (target_type);
if (!expr_element_type.IsValueType &&
!target_element_type.IsValueType)
- if
(ImplicitStandardConversionExists (ConstantEC, MyEmptyExpr,
+ if
(WideningStandardConversionExists (ConstantEC, MyEmptyExpr,
target_element_type))
return true;
}
@@ -381,7 +381,7 @@
/// expr is the expression to convert, returns a new
expression of type
/// target_type or null if an implicit conversion is not
possible.
/// </summary>
- static public Expression ImplicitNumericConversion (EmitContext
ec, Expression expr,
+ static public Expression WideningNumericConversion (EmitContext
ec, Expression expr,
Type
target_type, Location loc)
{
Type expr_type = expr.Type;
@@ -393,7 +393,7 @@
if (expr is IntConstant){
Expression e;
- e = TryImplicitIntConversion
(target_type, (IntConstant) expr);
+ e = TryWideningIntConversion
(target_type, (IntConstant) expr);
if (e != null)
return e;
@@ -543,15 +543,15 @@
/// <summary>
- /// Same as ImplicitStandardConversionExists except that it
also looks at
+ /// Same as WideningStandardConversionExists except that it
also looks at
/// implicit user defined conversions - needed for overload
resolution
/// </summary>
- public static bool ImplicitConversionExists (EmitContext ec,
Expression expr, Type target_type)
+ public static bool WideningConversionExists (EmitContext ec,
Expression expr, Type target_type)
{
if ((expr is NullLiteral) &&
target_type.IsGenericParameter)
return TypeParameter_to_Null (target_type);
- if (ImplicitStandardConversionExists (ec, expr,
target_type))
+ if (WideningStandardConversionExists (ec, expr,
target_type))
return true;
//
@@ -583,7 +583,7 @@
///
/// ec should point to a real EmitContext if expr.Type is
TypeManager.anonymous_method_type.
/// </summary>
- public static bool ImplicitStandardConversionExists
(EmitContext ec, Expression expr, Type target_type)
+ public static bool WideningStandardConversionExists
(EmitContext ec, Expression expr, Type target_type)
{
Type expr_type = expr.Type;
@@ -716,7 +716,7 @@
}
}
- if (ImplicitReferenceConversionExists (ec, expr,
target_type))
+ if (WideningReferenceConversionExists (ec, expr,
target_type))
return true;
//
@@ -776,7 +776,7 @@
//
// If `expr_type' implements `target_type' (which is an
iface)
- // see TryImplicitIntConversion
+ // see TryWideningIntConversion
//
if (target_type.IsInterface &&
target_type.IsAssignableFrom (expr_type))
return true;
@@ -824,7 +824,7 @@
continue;
}
- if (ImplicitStandardConversionExists (ec,
priv_fmet_param, best))
+ if (WideningStandardConversionExists (ec,
priv_fmet_param, best))
best = t;
}
@@ -857,7 +857,7 @@
continue;
}
- if (ImplicitStandardConversionExists (ec,
priv_fmee_ret, t))
+ if (WideningStandardConversionExists (ec,
priv_fmee_ret, t))
best = t;
}
@@ -904,17 +904,17 @@
// or encompassed by S to a type
encompassing or encompassed by T
//
priv_fms_expr.SetType (param_type);
- if (ImplicitStandardConversionExists
(ec, priv_fms_expr, source_type))
+ if (WideningStandardConversionExists
(ec, priv_fms_expr, source_type))
src_types_set.Add (param_type);
else {
- if
(ImplicitStandardConversionExists (ec, source, param_type))
+ if
(WideningStandardConversionExists (ec, source, param_type))
src_types_set.Add
(param_type);
}
} else {
//
// Only if S is encompassed by
param_type
//
- if (ImplicitStandardConversionExists
(ec, source, param_type))
+ if (WideningStandardConversionExists
(ec, source, param_type))
src_types_set.Add (param_type);
}
}
@@ -926,7 +926,7 @@
ArrayList candidate_set = new ArrayList ();
foreach (Type param_type in src_types_set){
- if (ImplicitStandardConversionExists
(ec, source, param_type))
+ if (WideningStandardConversionExists
(ec, source, param_type))
candidate_set.Add (param_type);
}
@@ -980,11 +980,11 @@
// or encompassed by S to a type
encompassing or encompassed by T
//
priv_fms_expr.SetType (ret_type);
- if (ImplicitStandardConversionExists
(ec, priv_fms_expr, target))
+ if (WideningStandardConversionExists
(ec, priv_fms_expr, target))
tgt_types_set.Add (ret_type);
else {
priv_fms_expr.SetType (target);
- if
(ImplicitStandardConversionExists (ec, priv_fms_expr, ret_type))
+ if
(WideningStandardConversionExists (ec, priv_fms_expr, ret_type))
tgt_types_set.Add
(ret_type);
}
} else {
@@ -992,7 +992,7 @@
// Only if T is encompassed by
param_type
//
priv_fms_expr.SetType (ret_type);
- if (ImplicitStandardConversionExists
(ec, priv_fms_expr, target))
+ if (WideningStandardConversionExists
(ec, priv_fms_expr, target))
tgt_types_set.Add (ret_type);
}
}
@@ -1006,7 +1006,7 @@
foreach (Type ret_type in tgt_types_set){
priv_fmt_expr.SetType (ret_type);
- if (ImplicitStandardConversionExists
(ec, priv_fmt_expr, target))
+ if (WideningStandardConversionExists
(ec, priv_fmt_expr, target))
candidate_set.Add (ret_type);
}
@@ -1181,9 +1181,9 @@
// by target.
//
if (look_for_explicit)
- source = ExplicitConversionStandard (ec,
source, most_specific_source, loc);
+ source = WideningAndNarrowingConversionStandard
(ec, source, most_specific_source, loc);
else
- source = ImplicitConversionStandard (ec,
source, most_specific_source, loc);
+ source = WideningConversionStandard (ec,
source, most_specific_source, loc);
if (source == null)
return null;
@@ -1192,9 +1192,9 @@
e = new UserCast ((MethodInfo) method, source, loc);
if (e.Type != target){
if (!look_for_explicit)
- e = ImplicitConversionStandard (ec, e,
target, loc);
+ e = WideningConversionStandard (ec, e,
target, loc);
else
- e = ExplicitConversionStandard (ec, e,
target, loc);
+ e =
WideningAndNarrowingConversionStandard (ec, e, target, loc);
}
return e;
@@ -1205,7 +1205,7 @@
/// `target_type'. It returns a new expression that can be
used
/// in a context that expects a `target_type'.
/// </summary>
- static public Expression ImplicitConversion (EmitContext ec,
Expression expr,
+ static public Expression WideningConversion (EmitContext ec,
Expression expr,
Type target_type,
Location loc)
{
Expression e;
@@ -1213,7 +1213,7 @@
if (target_type == null)
throw new Exception ("Target type is null");
- e = ImplicitConversionStandard (ec, expr, target_type,
loc);
+ e = WideningConversionStandard (ec, expr, target_type,
loc);
if (e != null)
return e;
@@ -1236,10 +1236,10 @@
/// that can be used in a context that expects a
/// `target_type'.
///
- /// This is different from `ImplicitConversion' in that the
+ /// This is different from `WideningConversion' in that the
/// user defined implicit conversions are excluded.
/// </summary>
- static public Expression ImplicitConversionStandard
(EmitContext ec, Expression expr,
+ static public Expression WideningConversionStandard
(EmitContext ec, Expression expr,
Type
target_type, Location loc)
{
Type expr_type = expr.Type;
@@ -1266,11 +1266,11 @@
if (expr_type.Equals (target_type) &&
!TypeManager.IsNullType (expr_type))
return expr;
- e = ImplicitNumericConversion (ec, expr, target_type,
loc);
+ e = WideningNumericConversion (ec, expr, target_type,
loc);
if (e != null)
return e;
- e = ImplicitReferenceConversion (ec, expr, target_type);
+ e = WideningReferenceConversion (ec, expr, target_type);
if (e != null)
return e;
@@ -1339,7 +1339,7 @@
/// into a different data type using casts (See Implicit
Constant
/// Expression Conversions)
/// </summary>
- static public Expression TryImplicitIntConversion (Type
target_type, IntConstant ic)
+ static public Expression TryWideningIntConversion (Type
target_type, IntConstant ic)
{
int value = ic.Value;
@@ -1397,7 +1397,7 @@
return null;
}
- static public void Error_CannotImplicitConversion (Location
loc, Type source, Type target)
+ static public void Error_CannotWideningConversion (Location
loc, Type source, Type target)
{
if (source.Name == target.Name){
Report.ExtraInformation (loc,
@@ -1414,16 +1414,16 @@
/// <summary>
/// Attempts to implicitly convert `source' into
`target_type', using
- /// ImplicitConversion. If there is no implicit conversion,
then
+ /// WideningConversion. If there is no implicit conversion,
then
/// an error is signaled
/// </summary>
- static public Expression ImplicitConversionRequired
(EmitContext ec, Expression source,
+ static public Expression WideningConversionRequired
(EmitContext ec, Expression source,
Type
target_type, Location loc)
{
Expression e;
int errors = Report.Errors;
- e = ImplicitConversion (ec, source, target_type, loc);
+ e = WideningConversion (ec, source, target_type, loc);
if (Report.Errors > errors)
return null;
if (e != null)
@@ -1447,7 +1447,7 @@
return null;
}
- Error_CannotImplicitConversion (loc, source.Type,
target_type);
+ Error_CannotWideningConversion (loc, source.Type,
target_type);
return null;
}
@@ -1461,7 +1461,7 @@
/// <summary>
/// Performs the explicit numeric conversions
/// </summary>
- static Expression ExplicitNumericConversion (EmitContext ec,
Expression expr, Type target_type, Location loc)
+ static Expression NarrowingNumericConversion (EmitContext ec,
Expression expr, Type target_type, Location loc)
{
Type expr_type = expr.Type;
@@ -1475,8 +1475,8 @@
if (TypeManager.IsEnumType (real_target_type))
real_target_type = TypeManager.EnumToUnderlying
(real_target_type);
- if (ImplicitStandardConversionExists (ec, expr,
real_target_type)){
- Expression ce = ImplicitConversionStandard (ec,
expr, real_target_type, loc);
+ if (WideningStandardConversionExists (ec, expr,
real_target_type)){
+ Expression ce = WideningConversionStandard (ec,
expr, real_target_type, loc);
if (real_target_type != target_type)
return new EmptyCast (ce, target_type);
@@ -1678,7 +1678,7 @@
/// Returns whether an explicit reference conversion can be
performed
/// from source_type to target_type
/// </summary>
- public static bool ExplicitReferenceConversionExists (Type
source_type, Type target_type)
+ public static bool NarrowingReferenceConversionExists (Type
source_type, Type target_type)
{
bool target_is_type_param =
target_type.IsGenericParameter;
bool target_is_value_type = target_type.IsValueType;
@@ -1743,7 +1743,7 @@
Type target_element_type =
TypeManager.GetElementType (target_type);
if (!source_element_type.IsValueType &&
!target_element_type.IsValueType)
- if
(ExplicitReferenceConversionExists (source_element_type,
+ if
(NarrowingReferenceConversionExists (source_element_type,
target_element_type))
return true;
}
@@ -1777,7 +1777,7 @@
/// <summary>
/// Implements Explicit Reference conversions
/// </summary>
- static Expression ExplicitReferenceConversion (Expression
source, Type target_type)
+ static Expression NarrowingReferenceConversion (Expression
source, Type target_type)
{
Type source_type = source.Type;
bool target_is_type_param =
target_type.IsGenericParameter;
@@ -1860,7 +1860,7 @@
Type target_element_type =
TypeManager.GetElementType (target_type);
if (!source_element_type.IsValueType &&
!target_element_type.IsValueType)
- if
(ExplicitReferenceConversionExists (source_element_type,
+ if
(NarrowingReferenceConversionExists (source_element_type,
target_element_type))
return new ClassCast
(source, target_type);
}
@@ -1895,7 +1895,7 @@
/// Performs an explicit conversion of the expression `expr'
whose
/// type is expr.Type to `target_type'.
/// </summary>
- static public Expression ExplicitConversion (EmitContext ec,
Expression expr,
+ static public Expression WideningAndNarrowingConversion
(EmitContext ec, Expression expr,
Type target_type,
Location loc)
{
Type expr_type = expr.Type;
@@ -1924,14 +1924,14 @@
}
int errors = Report.Errors;
- Expression ne = ImplicitConversionStandard (ec, expr,
target_type, loc);
+ Expression ne = WideningConversionStandard (ec, expr,
target_type, loc);
if (Report.Errors > errors)
return null;
if (ne != null)
return ne;
- ne = ExplicitNumericConversion (ec, expr, target_type,
loc);
+ ne = NarrowingNumericConversion (ec, expr, target_type,
loc);
if (ne != null)
return ne;
@@ -1942,12 +1942,12 @@
return new UnboxCast (expr, target_type);
//
- // Skip the ExplicitReferenceConversion because we can
not convert
+ // Skip the NarrowingReferenceConversion because we can
not convert
// from Null to a ValueType, and ExplicitReference wont
check against
// null literal explicitly
//
if (expr_type != TypeManager.null_type){
- ne = ExplicitReferenceConversion (expr,
target_type);
+ ne = NarrowingReferenceConversion (expr,
target_type);
if (ne != null)
return ne;
}
@@ -1992,12 +1992,12 @@
if (e != null){
Expression ci, ce;
- ci = ImplicitConversionStandard
(ec, e, target_type, loc);
+ ci = WideningConversionStandard
(ec, e, target_type, loc);
if (ci != null)
return ci;
- ce = ExplicitNumericConversion
(ec, e, target_type, loc);
+ ce = NarrowingNumericConversion
(ec, e, target_type, loc);
if (ce != null)
return ce;
//
@@ -2029,24 +2029,24 @@
}
/// <summary>
- /// Same as ExplicitConversion, only it doesn't include user
defined conversions
+ /// Same as WideningAndNarrowingConversion, only it doesn't
include user defined conversions
/// </summary>
- static public Expression ExplicitConversionStandard
(EmitContext ec, Expression expr,
+ static public Expression WideningAndNarrowingConversionStandard
(EmitContext ec, Expression expr,
Type
target_type, Location l)
{
int errors = Report.Errors;
- Expression ne = ImplicitConversionStandard (ec, expr,
target_type, l);
+ Expression ne = WideningConversionStandard (ec, expr,
target_type, l);
if (Report.Errors > errors)
return null;
if (ne != null)
return ne;
- ne = ExplicitNumericConversion (ec, expr, target_type,
l);
+ ne = NarrowingNumericConversion (ec, expr, target_type,
l);
if (ne != null)
return ne;
- ne = ExplicitReferenceConversion (expr, target_type);
+ ne = NarrowingReferenceConversion (expr, target_type);
if (ne != null)
return ne;
Modified: trunk/mcs/bmcs/ecore.cs
===================================================================
--- trunk/mcs/bmcs/ecore.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/ecore.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -862,7 +862,7 @@
if (e.Type == TypeManager.bool_type)
return e;
- Expression converted = Convert.ImplicitConversion (ec,
e, TypeManager.bool_type, new Location (-1));
+ Expression converted = Convert.WideningConversion (ec,
e, TypeManager.bool_type, new Location (-1));
if (converted != null)
return converted;
@@ -973,8 +973,8 @@
/// </summary>
public static object ConvertIntLiteral (Constant c, Type
target_type, Location loc)
{
- if (!Convert.ImplicitStandardConversionExists
(Convert.ConstantEC, c, target_type)){
- Convert.Error_CannotImplicitConversion (loc,
c.Type, target_type);
+ if (!Convert.WideningStandardConversionExists
(Convert.ConstantEC, c, target_type)){
+ Convert.Error_CannotWideningConversion (loc,
c.Type, target_type);
return null;
}
@@ -1346,15 +1346,15 @@
bool old_checked = ec.CheckState;
ec.CheckState = true;
- target = Convert.ImplicitConversion (ec, source,
TypeManager.int32_type, loc);
+ target = Convert.WideningConversion (ec, source,
TypeManager.int32_type, loc);
if (target == null){
- target = Convert.ImplicitConversion (ec,
source, TypeManager.uint32_type, loc);
+ target = Convert.WideningConversion (ec,
source, TypeManager.uint32_type, loc);
if (target == null){
- target = Convert.ImplicitConversion
(ec, source, TypeManager.int64_type, loc);
+ target = Convert.WideningConversion
(ec, source, TypeManager.int64_type, loc);
if (target == null){
- target =
Convert.ImplicitConversion (ec, source, TypeManager.uint64_type, loc);
+ target =
Convert.WideningConversion (ec, source, TypeManager.uint64_type, loc);
if (target == null)
-
Convert.Error_CannotImplicitConversion (loc, source.Type,
TypeManager.int32_type);
+
Convert.Error_CannotWideningConversion (loc, source.Type,
TypeManager.int32_type);
}
}
}
Modified: trunk/mcs/bmcs/enum.cs
===================================================================
--- trunk/mcs/bmcs/enum.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/enum.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -366,7 +366,7 @@
/// Determines if a standard implicit conversion exists from
/// expr_type to target_type
/// </summary>
- public static bool ImplicitConversionExists (Type expr_type,
Type target_type)
+ public static bool WideningConversionExists (Type expr_type,
Type target_type)
{
expr_type = TypeManager.TypeToCoreType (expr_type);
@@ -589,8 +589,8 @@
if (val is EnumConstant){
Type etype =
TypeManager.EnumToUnderlying (c.Type);
- if (!ImplicitConversionExists (etype,
UnderlyingType)){
-
Convert.Error_CannotImplicitConversion (
+ if (!WideningConversionExists (etype,
UnderlyingType)){
+
Convert.Error_CannotWideningConversion (
loc, c.Type,
UnderlyingType);
return null;
}
Modified: trunk/mcs/bmcs/expression.cs
===================================================================
--- trunk/mcs/bmcs/expression.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/expression.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -262,16 +262,16 @@
(expr_type.IsSubclassOf
(TypeManager.enum_type)))){
result = null;
- if (Convert.ImplicitConversionExists
(ec, e, TypeManager.int32_type)){
+ if (Convert.WideningConversionExists
(ec, e, TypeManager.int32_type)){
result = new Cast (new
TypeExpression (TypeManager.int32_type, loc), e, loc);
result = result.Resolve (ec);
- } else if
(Convert.ImplicitConversionExists (ec, e, TypeManager.uint32_type)){
+ } else if
(Convert.WideningConversionExists (ec, e, TypeManager.uint32_type)){
result = new Cast (new
TypeExpression (TypeManager.uint32_type, loc), e, loc);
result = result.Resolve (ec);
- } else if
(Convert.ImplicitConversionExists (ec, e, TypeManager.int64_type)){
+ } else if
(Convert.WideningConversionExists (ec, e, TypeManager.int64_type)){
result = new Cast (new
TypeExpression (TypeManager.int64_type, loc), e, loc);
result = result.Resolve (ec);
- } else if
(Convert.ImplicitConversionExists (ec, e, TypeManager.uint64_type)){
+ } else if
(Convert.WideningConversionExists (ec, e, TypeManager.uint64_type)){
result = new Cast (new
TypeExpression (TypeManager.uint64_type, loc), e, loc);
result = result.Resolve (ec);
}
@@ -389,22 +389,22 @@
(expr_type.IsSubclassOf
(TypeManager.enum_type)))){
Expression e;
- e = Convert.ImplicitConversion (ec,
Expr, TypeManager.int32_type, loc);
+ e = Convert.WideningConversion (ec,
Expr, TypeManager.int32_type, loc);
if (e != null){
type = TypeManager.int32_type;
return this;
}
- e = Convert.ImplicitConversion (ec,
Expr, TypeManager.uint32_type, loc);
+ e = Convert.WideningConversion (ec,
Expr, TypeManager.uint32_type, loc);
if (e != null){
type = TypeManager.uint32_type;
return this;
}
- e = Convert.ImplicitConversion (ec,
Expr, TypeManager.int64_type, loc);
+ e = Convert.WideningConversion (ec,
Expr, TypeManager.int64_type, loc);
if (e != null){
type = TypeManager.int64_type;
return this;
}
- e = Convert.ImplicitConversion (ec,
Expr, TypeManager.uint64_type, loc);
+ e = Convert.WideningConversion (ec,
Expr, TypeManager.uint64_type, loc);
if (e != null){
type = TypeManager.uint64_type;
return this;
@@ -510,7 +510,7 @@
//
//
// The following is inneficient, because we call
- // ImplicitConversion too many times.
+ // WideningConversion too many times.
//
// It is also not clear if we should convert to
Float
// or Double initially.
@@ -522,7 +522,7 @@
// bt wrote as a decimal interger
literal
//
type = TypeManager.int64_type;
- Expr = Convert.ImplicitConversion (ec,
Expr, type, loc);
+ Expr = Convert.WideningConversion (ec,
Expr, type, loc);
return this;
}
@@ -541,21 +541,21 @@
return this;
}
- expr = Convert.ImplicitConversion (ec, Expr,
TypeManager.int32_type, loc);
+ expr = Convert.WideningConversion (ec, Expr,
TypeManager.int32_type, loc);
if (expr != null){
Expr = expr;
type = expr.Type;
return this;
}
- expr = Convert.ImplicitConversion (ec, Expr,
TypeManager.int64_type, loc);
+ expr = Convert.WideningConversion (ec, Expr,
TypeManager.int64_type, loc);
if (expr != null){
Expr = expr;
type = expr.Type;
return this;
}
- expr = Convert.ImplicitConversion (ec, Expr,
TypeManager.double_type, loc);
+ expr = Convert.WideningConversion (ec, Expr,
TypeManager.double_type, loc);
if (expr != null){
Expr = expr;
type = expr.Type;
@@ -1156,7 +1156,7 @@
// First case, if at compile time, there is an implicit
conversion
// then e != null (objects) or true (value types)
//
- e = Convert.ImplicitConversionStandard (ec, expr,
probe_type, loc);
+ e = Convert.WideningConversionStandard (ec, expr,
probe_type, loc);
if (e != null){
expr = e;
if (etype.IsValueType)
@@ -1165,7 +1165,7 @@
action = Action.LeaveOnStack;
warning_always_matches = true;
- } else if (Convert.ExplicitReferenceConversionExists
(etype, probe_type)){
+ } else if (Convert.NarrowingReferenceConversionExists
(etype, probe_type)){
if (etype.IsGenericParameter)
expr = new BoxedCast (expr, etype);
@@ -1239,14 +1239,14 @@
}
- e = Convert.ImplicitConversion (ec, expr, probe_type,
loc);
+ e = Convert.WideningConversion (ec, expr, probe_type,
loc);
if (e != null){
expr = e;
do_isinst = false;
return this;
}
- if (Convert.ExplicitReferenceConversionExists (etype,
probe_type)){
+ if (Convert.NarrowingReferenceConversionExists (etype,
probe_type)){
if (etype.IsGenericParameter)
expr = new BoxedCast (expr, etype);
@@ -1813,7 +1813,7 @@
UnsafeError (loc);
return null;
}
- expr = Convert.ExplicitConversion (ec, expr, type, loc);
+ expr = Convert.WideningAndNarrowingConversion (ec,
expr, type, loc);
return expr;
}
@@ -1968,7 +1968,7 @@
if (expr.Type == target_type)
return expr;
- return Convert.ImplicitConversion (ec, expr,
target_type, loc);
+ return Convert.WideningConversion (ec, expr,
target_type, loc);
}
public static void Error_OperatorAmbiguous (Location loc,
Operator oper, Type l, Type r)
@@ -2020,9 +2020,9 @@
// conveted to type double.
//
if (r != TypeManager.double_type)
- right = Convert.ImplicitConversion (ec,
right, TypeManager.double_type, loc);
+ right = Convert.WideningConversion (ec,
right, TypeManager.double_type, loc);
if (l != TypeManager.double_type)
- left = Convert.ImplicitConversion (ec,
left, TypeManager.double_type, loc);
+ left = Convert.WideningConversion (ec,
left, TypeManager.double_type, loc);
type = TypeManager.double_type;
} else if (IsOfType (ec, l, r, TypeManager.float_type,
check_user_conv)){
@@ -2031,9 +2031,9 @@
// converted to type float.
//
if (r != TypeManager.double_type)
- right = Convert.ImplicitConversion (ec,
right, TypeManager.float_type, loc);
+ right = Convert.WideningConversion (ec,
right, TypeManager.float_type, loc);
if (l != TypeManager.double_type)
- left = Convert.ImplicitConversion (ec,
left, TypeManager.float_type, loc);
+ left = Convert.WideningConversion (ec,
left, TypeManager.float_type, loc);
type = TypeManager.float_type;
} else if (IsOfType (ec, l, r, TypeManager.uint64_type,
check_user_conv)){
Expression e;
@@ -2048,7 +2048,7 @@
if (right is IntConstant){
IntConstant ic =
(IntConstant) right;
- e =
Convert.TryImplicitIntConversion (l, ic);
+ e =
Convert.TryWideningIntConversion (l, ic);
if (e != null)
right = e;
} else if (right is
LongConstant){
@@ -2057,7 +2057,7 @@
if (ll >= 0)
right = new
ULongConstant ((ulong) ll);
} else {
- e =
Convert.ImplicitNumericConversion (ec, right, l, loc);
+ e =
Convert.WideningNumericConversion (ec, right, l, loc);
if (e != null)
right = e;
}
@@ -2065,7 +2065,7 @@
other = right.Type;
} else {
if (left is IntConstant){
- e =
Convert.TryImplicitIntConversion (r, (IntConstant) left);
+ e =
Convert.TryWideningIntConversion (r, (IntConstant) left);
if (e != null)
left = e;
} else if (left is LongConstant){
@@ -2074,7 +2074,7 @@
if (ll > 0)
left = new
ULongConstant ((ulong) ll);
} else {
- e =
Convert.ImplicitNumericConversion (ec, left, r, loc);
+ e =
Convert.WideningNumericConversion (ec, left, r, loc);
if (e != null)
left = e;
}
@@ -2097,9 +2097,9 @@
// to type long.
//
if (l != TypeManager.int64_type)
- left = Convert.ImplicitConversion (ec,
left, TypeManager.int64_type, loc);
+ left = Convert.WideningConversion (ec,
left, TypeManager.int64_type, loc);
if (r != TypeManager.int64_type)
- right = Convert.ImplicitConversion (ec,
right, TypeManager.int64_type, loc);
+ right = Convert.WideningConversion (ec,
right, TypeManager.int64_type, loc);
type = TypeManager.int64_type;
} else if (IsOfType (ec, l, r, TypeManager.uint32_type,
check_user_conv)){
@@ -2155,10 +2155,10 @@
}
} else if (l == TypeManager.decimal_type || r ==
TypeManager.decimal_type){
if (l != TypeManager.decimal_type)
- left = Convert.ImplicitConversion (ec,
left, TypeManager.decimal_type, loc);
+ left = Convert.WideningConversion (ec,
left, TypeManager.decimal_type, loc);
if (r != TypeManager.decimal_type)
- right = Convert.ImplicitConversion (ec,
right, TypeManager.decimal_type, loc);
+ right = Convert.WideningConversion (ec,
right, TypeManager.decimal_type, loc);
type = TypeManager.decimal_type;
} else {
left = ForceConversion (ec, left,
TypeManager.int32_type);
@@ -2205,16 +2205,16 @@
if (t == TypeManager.int32_type || t ==
TypeManager.uint32_type ||
t == TypeManager.int64_type || t ==
TypeManager.uint64_type)
return e;
- Expression ee = Convert.ImplicitConversion (ec, e,
TypeManager.int32_type, loc);
+ Expression ee = Convert.WideningConversion (ec, e,
TypeManager.int32_type, loc);
if (ee != null)
return ee;
- ee = Convert.ImplicitConversion (ec, e,
TypeManager.uint32_type, loc);
+ ee = Convert.WideningConversion (ec, e,
TypeManager.uint32_type, loc);
if (ee != null)
return ee;
- ee = Convert.ImplicitConversion (ec, e,
TypeManager.int64_type, loc);
+ ee = Convert.WideningConversion (ec, e,
TypeManager.int64_type, loc);
if (ee != null)
return ee;
- ee = Convert.ImplicitConversion (ec, e,
TypeManager.uint64_type, loc);
+ ee = Convert.WideningConversion (ec, e,
TypeManager.uint64_type, loc);
if (ee != null)
return ee;
return null;
@@ -2231,10 +2231,10 @@
}
right = e;
- if (((e = Convert.ImplicitConversion (ec, left,
TypeManager.int32_type, loc)) != null) ||
- ((e = Convert.ImplicitConversion (ec, left,
TypeManager.uint32_type, loc)) != null) ||
- ((e = Convert.ImplicitConversion (ec, left,
TypeManager.int64_type, loc)) != null) ||
- ((e = Convert.ImplicitConversion (ec, left,
TypeManager.uint64_type, loc)) != null)){
+ if (((e = Convert.WideningConversion (ec, left,
TypeManager.int32_type, loc)) != null) ||
+ ((e = Convert.WideningConversion (ec, left,
TypeManager.uint32_type, loc)) != null) ||
+ ((e = Convert.WideningConversion (ec, left,
TypeManager.int64_type, loc)) != null) ||
+ ((e = Convert.WideningConversion (ec, left,
TypeManager.uint64_type, loc)) != null)){
left = e;
type = e.Type;
@@ -2421,8 +2421,8 @@
//
// Also, a standard conversion must
exist from either one
//
- if
(!(Convert.ImplicitStandardConversionExists (ec, left, r) ||
-
Convert.ImplicitStandardConversionExists (ec, right, l))){
+ if
(!(Convert.WideningStandardConversionExists (ec, left, r) ||
+
Convert.WideningStandardConversionExists (ec, right, l))){
Error_OperatorCannotBeApplied
();
return null;
}
@@ -2457,7 +2457,7 @@
if (((right.eclass ==
ExprClass.MethodGroup) ||
(r ==
TypeManager.anonymous_method_type))){
if ((RootContext.Version !=
LanguageVersion.ISO_1)){
- Expression tmp =
Convert.ImplicitConversionRequired (ec, right, l, loc);
+ Expression tmp =
Convert.WideningConversionRequired (ec, right, l, loc);
if (tmp == null)
return null;
right = tmp;
@@ -2555,7 +2555,7 @@
Type underlying_type =
TypeManager.EnumToUnderlying (enum_type);
if (underlying_type != other_type){
- temp =
Convert.ImplicitConversion (ec, lie ? right : left, underlying_type, loc);
+ temp =
Convert.WideningConversion (ec, lie ? right : left, underlying_type, loc);
if (temp != null){
if (lie)
right = temp;
@@ -2574,7 +2574,7 @@
}
if (!rie){
- temp = Convert.ImplicitConversion (ec,
right, l, loc);
+ temp = Convert.WideningConversion (ec,
right, l, loc);
if (temp != null)
right = temp;
else {
@@ -2582,7 +2582,7 @@
return null;
}
} if (!lie){
- temp = Convert.ImplicitConversion (ec,
left, r, loc);
+ temp = Convert.WideningConversion (ec,
left, r, loc);
if (temp != null){
left = temp;
l = r;
@@ -3174,7 +3174,7 @@
// Conversion to object
//
if (operand.Type != TypeManager.string_type) {
- Expression no = Convert.ImplicitConversion (ec,
operand, TypeManager.object_type, loc);
+ Expression no = Convert.WideningConversion (ec,
operand, TypeManager.object_type, loc);
if (no == null) {
Binary.Error_OperatorCannotBeApplied
(loc, "+", TypeManager.string_type, operand.Type);
@@ -3535,12 +3535,12 @@
// First, if an implicit conversion exists from
trueExpr
// to falseExpr, then the result type is of
type falseExpr.Type
//
- conv = Convert.ImplicitConversion (ec,
trueExpr, false_type, loc);
+ conv = Convert.WideningConversion (ec,
trueExpr, false_type, loc);
if (conv != null){
//
// Check if both can convert implicitl
to each other's type
//
- if (Convert.ImplicitConversion (ec,
falseExpr, true_type, loc) != null){
+ if (Convert.WideningConversion (ec,
falseExpr, true_type, loc) != null){
Error (172,
"Can not compute type of
conditional expression " +
"as `" +
TypeManager.CSharpName (trueExpr.Type) +
@@ -3550,7 +3550,7 @@
}
type = false_type;
trueExpr = conv;
- } else if ((conv =
Convert.ImplicitConversion(ec, falseExpr, true_type,loc))!= null){
+ } else if ((conv =
Convert.WideningConversion(ec, falseExpr, true_type,loc))!= null){
type = true_type;
falseExpr = conv;
} else {
@@ -4387,8 +4387,8 @@
Expression p_tmp = new EmptyExpression (p);
Expression q_tmp = new EmptyExpression (q);
- bool p_to_q = Convert.ImplicitConversionExists (ec,
p_tmp, q);
- bool q_to_p = Convert.ImplicitConversionExists (ec,
q_tmp, p);
+ bool p_to_q = Convert.WideningConversionExists (ec,
p_tmp, q);
+ bool q_to_p = Convert.WideningConversionExists (ec,
q_tmp, p);
if (p_to_q && !q_to_p)
return p;
@@ -4687,7 +4687,7 @@
if (a_mod == p_mod) {
if (a_mod == Parameter.Modifier.NONE)
- if
(!Convert.ImplicitConversionExists (ec,
+ if
(!Convert.WideningConversionExists (ec,
a.Expr,
pd.ParameterType (i)))
return false;
@@ -4719,7 +4719,7 @@
for (int i = pd_count - 1; i < arg_count; i++) {
Argument a = (Argument) arguments [i];
- if (!Convert.ImplicitConversionExists (ec,
a.Expr, element_type))
+ if (!Convert.WideningConversionExists (ec,
a.Expr, element_type))
return false;
}
@@ -4763,7 +4763,7 @@
if (a_mod == p_mod ||
(a_mod == Parameter.Modifier.NONE && p_mod
== Parameter.Modifier.PARAMS)) {
if (a_mod == Parameter.Modifier.NONE) {
- if
(!Convert.ImplicitConversionExists (ec,
+ if
(!Convert.WideningConversionExists (ec,
a.Expr,
pd.ParameterType (i)))
return false;
@@ -5123,7 +5123,7 @@
if (!TypeManager.IsEqual (a.Type,
parameter_type)){
Expression conv;
- conv = Convert.ImplicitConversion (ec,
a_expr, parameter_type, loc);
+ conv = Convert.WideningConversion (ec,
a_expr, parameter_type, loc);
if (conv == null) {
if (!may_fail)
@@ -6201,7 +6201,7 @@
// Console.WriteLine ("I got: " + tmp);
// Handle initialization from vars,
fields etc.
- Expression conv =
Convert.ImplicitConversionRequired (
+ Expression conv =
Convert.WideningConversionRequired (
ec, tmp, underlying_type, loc);
if (conv == null)
@@ -6301,15 +6301,15 @@
bool old_checked = ec.CheckState;
ec.CheckState = true;
- target = Convert.ImplicitConversion (ec, source,
TypeManager.int32_type, loc);
+ target = Convert.WideningConversion (ec, source,
TypeManager.int32_type, loc);
if (target == null){
- target = Convert.ImplicitConversion (ec,
source, TypeManager.uint32_type, loc);
+ target = Convert.WideningConversion (ec,
source, TypeManager.uint32_type, loc);
if (target == null){
- target = Convert.ImplicitConversion
(ec, source, TypeManager.int64_type, loc);
+ target = Convert.WideningConversion
(ec, source, TypeManager.int64_type, loc);
if (target == null){
- target =
Convert.ImplicitConversion (ec, source, TypeManager.uint64_type, loc);
+ target =
Convert.WideningConversion (ec, source, TypeManager.uint64_type, loc);
if (target == null)
-
Convert.Error_CannotImplicitConversion (loc, source.Type,
TypeManager.int32_type);
+
Convert.Error_CannotWideningConversion (loc, source.Type,
TypeManager.int32_type);
}
}
}
@@ -8981,7 +8981,7 @@
return null;
if (count.Type != TypeManager.int32_type){
- count = Convert.ImplicitConversionRequired (ec,
count, TypeManager.int32_type, loc);
+ count = Convert.WideningConversionRequired (ec,
count, TypeManager.int32_type, loc);
if (count == null)
return null;
}
Modified: trunk/mcs/bmcs/generic.cs
===================================================================
--- trunk/mcs/bmcs/generic.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/generic.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -386,8 +386,8 @@
Type t2 = constraints.ClassConstraint;
TypeExpr e2 = constraints.class_constraint;
- if (!Convert.ImplicitReferenceConversionExists
(ec, e1, t2) &&
- !Convert.ImplicitReferenceConversionExists
(ec, e2, t1)) {
+ if (!Convert.WideningReferenceConversionExists
(ec, e1, t2) &&
+ !Convert.WideningReferenceConversionExists
(ec, e2, t1)) {
Report.Error (455, loc,
"Type parameter `{0}'
inherits " +
"conflicting constraints
`{1}' and `{2}'",
@@ -1109,7 +1109,7 @@
ctype = ct.Type;
}
- return Convert.ImplicitStandardConversionExists (ec,
expr, ctype);
+ return Convert.WideningStandardConversionExists (ec,
expr, ctype);
}
protected bool CheckConstraints (EmitContext ec, int index)
Modified: trunk/mcs/bmcs/iterators.cs
===================================================================
--- trunk/mcs/bmcs/iterators.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/iterators.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -72,7 +72,7 @@
Iterator iterator = ec.CurrentIterator;
if (expr.Type != iterator.IteratorType){
- expr = Convert.ImplicitConversionRequired (
+ expr = Convert.WideningConversionRequired (
ec, expr, iterator.IteratorType, loc);
if (expr == null)
return false;
Modified: trunk/mcs/bmcs/statement.cs
===================================================================
--- trunk/mcs/bmcs/statement.cs 2005-02-27 21:29:04 UTC (rev 41265)
+++ trunk/mcs/bmcs/statement.cs 2005-02-27 22:12:07 UTC (rev 41266)
@@ -584,7 +584,7 @@
return false;
if (Expr.Type != ec.ReturnType) {
- Expr =
Convert.ImplicitConversionRequired (
+ Expr =
Convert.WideningConversionRequired (
ec, Expr, ec.ReturnType, loc);
if (Expr == null)
return false;
@@ -3441,7 +3441,7 @@
//
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;
@@ -3471,7 +3471,7 @@
// 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;
@@ -3541,7 +3541,7 @@
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)
@@ -3844,7 +3844,7 @@
continue;
}
- converted_vars [i] =
Convert.ImplicitConversionRequired (
+ converted_vars [i] =
Convert.WideningConversionRequired (
ec, var, TypeManager.idisposable_type,
loc);
if (converted_vars [i] == null)
@@ -3876,7 +3876,7 @@
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)
@@ -4170,7 +4170,7 @@
// 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;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches