return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is SByteConstant){
sbyte v = ((SByteConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is ShortConstant){
short v = ((ShortConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is UShortConstant){
ushort v = ((UShortConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is IntConstant){
int v = ((IntConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is UIntConstant){
uint v = ((UIntConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is LongConstant){
long v = ((LongConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is ULongConstant){
ulong v = ((ULongConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is FloatConstant){
float v = ((FloatConstant) expr).Value;
return new DoubleConstant ((double) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
if (expr is DoubleConstant){
double v = ((DoubleConstant) expr).Value;
return new FloatConstant ((float) v);
if (target_type == TypeManager.char_type)
return new CharConstant ((char) v);
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) v);
}
return null;
if (type_queried == null)
return null;
+ if (!TypeManager.IsUnmanagedType (type_queried)){
+ Report.Error (208, "Cannot take the size of an unmanaged type (" + TypeManager.CSharpName (type_queried) + ")");
+ return null;
+ }
+
type = TypeManager.int32_type;
eclass = ExprClass.Value;
return this;