//
// Attempt to do the implicit constant expression conversions
- if (expr is IntConstant){
+ if (expr is BoolConstant || expr is IntConstant || expr is LongConstant || expr is DoubleConstant || expr is FloatConstant){
Expression e;
- e = TryImplicitIntConversion (target_type, (IntConstant) expr);
+ e = TryImplicitNumericConversion (target_type, (Constant) expr);
if (e != null)
return e;
- } else if (expr is LongConstant && target_type == TypeManager.uint64_type){
+ if (target_type == TypeManager.byte_type ||
+ target_type == TypeManager.short_type ||
+ target_type == TypeManager.int32_type ||
+ target_type == TypeManager.int64_type ||
+ target_type == TypeManager.float_type) {
+
+ string val = null;
+ if (expr is IntConstant)
+ val = ((IntConstant) expr).Value.ToString();
+ if (expr is LongConstant)
+ val = ((LongConstant) expr).Value.ToString();
+ if (expr is FloatConstant)
+ val = ((FloatConstant) expr).Value.ToString();
+ if (expr is DoubleConstant)
+ val = ((DoubleConstant) expr).Value.ToString();
+ Error_ConstantValueCannotBeConverted(loc, val, target_type);
+ return null;
+ }
+ } else if (expr is LongConstant && target_type == TypeManager.uint64_type) {
//
// Try the implicit constant expression conversion
// from long to ulong, instead of a nice routine,
(target_type == TypeManager.decimal_type))
return true;
+ } else if (expr_type == TypeManager.decimal_type) {
+ if (target_type == TypeManager.float_type ||
+ target_type == TypeManager.double_type)
+ return true;
} else if (expr_type == TypeManager.float_type){
//
// float to double, decimal
} else if (target_type == TypeManager.char_type){
//
- // To char from ushort, int, uint, long, ulong, float, double
+ // To char from ushort, int, uint, long, ulong, float, double, decimal,string
//
if ((expr_type == TypeManager.ushort_type) ||
(expr_type == TypeManager.int32_type) ||
(expr_type == TypeManager.int64_type) ||
(expr_type == TypeManager.float_type) ||
(expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.decimal_type))
+ (expr_type == TypeManager.decimal_type) ||
+ (expr_type == TypeManager.string_type))
+
return true;
} else if (target_type == TypeManager.float_type){
//
// To sbyte from short, int, long, float, double.
//
- if ((expr_type == TypeManager.int32_type) ||
- (expr_type == TypeManager.int64_type) ||
- (expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.short_type) ||
- (expr_type == TypeManager.decimal_type))
- return new OpcodeCast (expr, target_type, OpCodes.Conv_I1);
+ if (expr_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_I1);
+ if (expr_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I1);
+ if (expr_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_I1);
+
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I1);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I1);
+ }
} else if (target_type == TypeManager.byte_type){
//
// To byte from short, ushort, int, uint, long, ulong, float, double
//
- if ((expr_type == TypeManager.short_type) ||
- (expr_type == TypeManager.ushort_type) ||
- (expr_type == TypeManager.int32_type) ||
- (expr_type == TypeManager.uint32_type) ||
- (expr_type == TypeManager.uint64_type) ||
- (expr_type == TypeManager.int64_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.decimal_type))
- return new OpcodeCast (expr, target_type, OpCodes.Conv_U1);
+ if (expr_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U1);
+ if (expr_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_U1);
+ if (expr_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U1);
+ if (expr_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_U1);
+ if (expr_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U1);
+ if (expr_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U1);
+
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U1);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U1);
+ }
- } else if (target_type == TypeManager.short_type){
+ } else if (target_type == TypeManager.short_type) {
//
// To short from int, long, float, double
//
- if ((expr_type == TypeManager.int32_type) ||
- (expr_type == TypeManager.int64_type) ||
- (expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.decimal_type))
+ if (expr_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_I2);
+ if (expr_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I2);
- return new OpcodeCast (expr, target_type, OpCodes.Conv_I2);
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I2);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I2);
+ }
- } else if (target_type == TypeManager.ushort_type){
+ } else if (target_type == TypeManager.ushort_type) {
//
// To ushort from int, uint, long, ulong, float, double
//
- if ((expr_type == TypeManager.uint32_type) ||
- (expr_type == TypeManager.uint64_type) ||
- (expr_type == TypeManager.int32_type) ||
- (expr_type == TypeManager.int64_type) ||
- (expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.decimal_type))
- return new OpcodeCast (expr, target_type, OpCodes.Conv_U2);
+ if (expr_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_U2);
+ if (expr_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U2);
+ if (expr_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U2);
+ if (expr_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U2);
+
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U2);
+ }
+
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U2);
+ }
} else if (target_type == TypeManager.int32_type){
//
// To int from long, float, double
//
- if ((expr_type == TypeManager.int64_type) ||
- (expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.decimal_type))
- return new OpcodeCast (expr, target_type, OpCodes.Conv_I4);
+ if (expr_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I4);
+
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I4);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I4);
+ }
} else if (target_type == TypeManager.uint32_type){
//
// To uint from long, ulong, float, double
//
- if ((expr_type == TypeManager.int64_type) ||
- (expr_type == TypeManager.uint64_type) ||
- (expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.decimal_type))
- return new OpcodeCast (expr, target_type, OpCodes.Conv_U4);
+ if (expr_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U4);
+ if (expr_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I4);
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U4);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U4);
+ }
- } else if ((target_type == TypeManager.uint64_type) ||
- (target_type == TypeManager.int64_type)) {
+ } else if (target_type == TypeManager.uint64_type) {
//
// To long/ulong from float, double
//
- if ((expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.decimal_type))
- return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U8);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U8);
+ }
+
+ } else if (target_type == TypeManager.int64_type) {
+ //
+ // To long/ulong from float, double
+ //
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I8);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I8);
+ }
} else if (target_type == TypeManager.char_type){
//
// To char from ushort, int, uint, long, ulong, float, double
//
- if ((expr_type == TypeManager.ushort_type) ||
- (expr_type == TypeManager.int32_type) ||
- (expr_type == TypeManager.uint32_type) ||
- (expr_type == TypeManager.uint64_type) ||
- (expr_type == TypeManager.int64_type) ||
- (expr_type == TypeManager.float_type) ||
- (expr_type == TypeManager.double_type) ||
- (expr_type == TypeManager.decimal_type))
- return new OpcodeCast (expr, target_type, OpCodes.Conv_U2);
+ if (expr_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_CH);
+ if (expr_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_CH);
+ if (expr_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_CH);
+ if (expr_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_CH);
+ if (expr_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_CH);
+
+ if (expr_type == TypeManager.float_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_CH);
+ }
+ if (expr_type == TypeManager.double_type) {
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math", ".Round", expr, loc);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_CH);
+ }
} else if (target_type == TypeManager.float_type){
//
// To float from double
//
if (expr_type == TypeManager.double_type)
- return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_R4);
}
TypeCode dest_type = Type.GetTypeCode (target_type);
TypeCode src_type = Type.GetTypeCode (expr_type);
Expression e = null;
- // VB.NET Objects can be converted to anything by default
- // unless, that is, an exception at runtime blows it all
- if (src_type == TypeCode.Object) {
- Expression cast_type = Mono.MonoBASIC.Parser.DecomposeQI(target_type.ToString(), loc);
- Cast ce = new Cast (cast_type, expr, loc);
- ce.IsRuntimeCast = true;
- return ce.Resolve (ec);
- }
-
switch (dest_type) {
case TypeCode.String:
switch (src_type) {
e = RTConversionExpression(ec, "DateType.FromObject", expr, loc);
break;
}
- break;
+ break;
+ case TypeCode.Char:
+ switch (src_type) {
+
+ case TypeCode.String:
+ e = RTConversionExpression(ec, "CharType.FromString", expr, loc);
+ break;
+
+ }
+ break;
}
// We must examine separately some types that
if (expr_type == typeof(System.String) && target_type == typeof (System.Char[])) {
e = RTConversionExpression(ec, "CharArrayType.FromString", expr, loc);
}
-
- return e;
+ if (e != null)
+ return e;
+ // VB.NET Objects can be converted to anything by default
+ // unless, that is, an exception at runtime blows it all
+ if (src_type == TypeCode.Object) {
+ Expression cast_type = Mono.MonoBASIC.Parser.DecomposeQI(target_type.ToString(), loc);
+ Cast ce = new Cast (cast_type, expr, loc);
+ ce.IsRuntimeCast = true;
+ return ce.Resolve (ec);
+ }
+ return null;
+ }
+
+ static public Expression ConvertNothingToDefaultValues (EmitContext ec, Expression expr,
+ Type target_type, Location loc)
+ {
+ switch (Type.GetTypeCode (target_type)) {
+ case TypeCode.Boolean :
+ return new BoolConstant (false);
+ case TypeCode.Byte :
+ return new ByteConstant (0);
+ case TypeCode.Char :
+ return new CharConstant ((char)0);
+ case TypeCode.SByte :
+ return new SByteConstant (0);
+ case TypeCode.Int16 :
+ return new ShortConstant (0);
+ case TypeCode.Int32 :
+ return new IntConstant (0);
+ case TypeCode.Int64 :
+ return new LongConstant (0);
+ case TypeCode.Decimal :
+ return new DecimalConstant (System.Decimal.Zero);
+ case TypeCode.Single :
+ return new FloatConstant (0.0F);
+ case TypeCode.Double :
+ return new DoubleConstant (0.0);
+ }
+
+ return null;
}
/// <summary>
Type expr_type = expr.Type;
Expression e;
+ if (expr is NullLiteral) {
+ if (target_type == TypeManager.string_type)
+ return expr;
+ e = ConvertNothingToDefaultValues (ec, expr, target_type, loc);
+ if (e != null)
+ return e;
+ }
+
if (expr_type == target_type)
return expr;
}
/// <summary>
- /// Attemps to perform an implict constant conversion of the IntConstant
+ /// Attemps to perform an implict constant conversion of the any Numeric Constant
/// into a different data type using casts (See Implicit Constant
/// Expression Conversions)
/// </summary>
- static protected Expression TryImplicitIntConversion (Type target_type, IntConstant ic)
- {
- int value = ic.Value;
+ static protected Expression TryImplicitNumericConversion (Type target_type, Constant ic)
+ {
+ double value = 0;
+ if (ic is BoolConstant) {
+ bool val = (bool) ((BoolConstant)ic).Value;
+ if (val) {
+ if (target_type == TypeManager.byte_type)
+ value = Byte.MaxValue;
+ else
+ value = -1;
+ }
+ }
+ if (ic is IntConstant)
+ value = (double)((IntConstant)ic).Value;
+
+ if (ic is LongConstant)
+ value = (double) ((LongConstant)ic).Value;
+
+ if (ic is FloatConstant) {
+ value = (double) ((FloatConstant)ic).Value;
+ }
+
+ if (ic is DoubleConstant) {
+ value = ((DoubleConstant)ic).Value;
+ }
//
// FIXME: This could return constants instead of EmptyCasts
//
- if (target_type == TypeManager.sbyte_type){
+ if (target_type == TypeManager.bool_type){
+ if (value != 0)
+ return new BoolConstant (true);
+ return new BoolConstant (false);
+ } else if (target_type == TypeManager.sbyte_type){
if (value >= SByte.MinValue && value <= SByte.MaxValue)
- return new SByteConstant ((sbyte) value);
+ return new SByteConstant ((sbyte) System.Math.Round (value));
} else if (target_type == TypeManager.byte_type){
- if (Byte.MinValue >= 0 && value <= Byte.MaxValue)
- return new ByteConstant ((byte) value);
+ if (value >= Byte.MinValue && value <= Byte.MaxValue)
+ return new ByteConstant ((byte) System.Math.Round (value));
} else if (target_type == TypeManager.short_type){
if (value >= Int16.MinValue && value <= Int16.MaxValue)
- return new ShortConstant ((short) value);
+ return new ShortConstant ((short) System.Math.Round (value));
} else if (target_type == TypeManager.ushort_type){
if (value >= UInt16.MinValue && value <= UInt16.MaxValue)
- return new UShortConstant ((ushort) value);
+ return new UShortConstant ((ushort) System.Math.Round (value));
+ } else if (target_type == TypeManager.int32_type){
+ if (value >= Int32.MinValue && value <= Int32.MaxValue)
+ return new IntConstant ((int) System.Math.Round (value));
} else if (target_type == TypeManager.uint32_type){
if (value >= 0)
- return new UIntConstant ((uint) value);
+ return new UIntConstant ((uint) System.Math.Round (value));
+ } else if (target_type == TypeManager.int64_type){
+ return new LongConstant ((long) System.Math.Round (value));
} else if (target_type == TypeManager.uint64_type){
//
// we can optimize this case: a positive int32
// to do it.
//
if (value >= 0)
- return new ULongConstant ((ulong) value);
+ return new ULongConstant ((ulong)System.Math.Round ( value));
+ } else if (target_type == TypeManager.float_type){
+ return new FloatConstant ((float) value);
+ } else if (target_type == TypeManager.double_type){
+ return new DoubleConstant ((double) value);
}
if (value == 0 && ic is IntLiteral && TypeManager.IsEnumType (target_type)){
throw new Exception (msg);
- Report.Error (29, loc, msg);
+ Report.Error (30512, loc, msg);
}
/// <summary>
// ushort, int, uint, long, ulong, char
// or decimal
//
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math",".Round" , expr, loc);
if (real_target_type == TypeManager.sbyte_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I1);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I1);
if (real_target_type == TypeManager.byte_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U1);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U1);
if (real_target_type == TypeManager.short_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I2);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I2);
if (real_target_type == TypeManager.ushort_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U2);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U2);
if (real_target_type == TypeManager.int32_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I4);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I4);
if (real_target_type == TypeManager.uint32_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U4);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U4);
if (real_target_type == TypeManager.int64_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I8);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_I8);
if (real_target_type == TypeManager.uint64_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U8);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_U8);
if (real_target_type == TypeManager.char_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_CH);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R4_CH);
} else if (expr_type == TypeManager.double_type){
//
// From double to byte, byte, short,
// ushort, int, uint, long, ulong,
// char, float or decimal
//
+ Expression rounded_expr = RTConversionExpression(ec, "System.Math",".Round" , expr, loc);
if (real_target_type == TypeManager.sbyte_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I1);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I1);
if (real_target_type == TypeManager.byte_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U1);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U1);
if (real_target_type == TypeManager.short_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I2);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I2);
if (real_target_type == TypeManager.ushort_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U2);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U2);
if (real_target_type == TypeManager.int32_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I4);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I4);
if (real_target_type == TypeManager.uint32_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U4);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U4);
if (real_target_type == TypeManager.int64_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I8);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_I8);
if (real_target_type == TypeManager.uint64_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U8);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_U8);
if (real_target_type == TypeManager.char_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_CH);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_CH);
if (real_target_type == TypeManager.float_type)
- return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_R4);
+ return new ConvCast (ec, rounded_expr, target_type, ConvCast.Mode.R8_R4);
}
// decimal is taken care of by the op_Explicit methods.
{
PropertyInfo = pi;
eclass = ExprClass.PropertyAccess;
- PropertyArgs = new ArrayList();
+ PropertyArgs = null;
is_static = false;
loc = l;
return;
}
}
+ if (PropertyArgs == null)
+ PropertyArgs = new ArrayList ();
Invocation.EmitCall (ec, IsBase, IsStatic, instance_expr, getter, null, PropertyArgs, loc);
}