+ if (target_type == TypeManager.byte_type) {
+ if (in_checked_context){
+ if (Value < Byte.MinValue || Value > Byte.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new ByteConstant ((byte) Value, Location);
+ }
+ if (target_type == TypeManager.sbyte_type) {
+ if (in_checked_context){
+ if (Value < SByte.MinValue || Value > SByte.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new SByteConstant ((sbyte) Value, Location);
+ }
+ if (target_type == TypeManager.short_type) {
+ if (in_checked_context){
+ if (Value < short.MinValue || Value > short.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new ShortConstant ((short) Value, Location);
+ }
+ if (target_type == TypeManager.ushort_type) {
+ if (in_checked_context){
+ if (Value < ushort.MinValue || Value > ushort.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new UShortConstant ((ushort) Value, Location);
+ }
+ if (target_type == TypeManager.int32_type) {
+ if (in_checked_context){
+ if (Value < int.MinValue || Value > int.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new IntConstant ((int) Value, Location);
+ }
+ if (target_type == TypeManager.uint32_type) {
+ if (in_checked_context){
+ if (Value < uint.MinValue || Value > uint.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new UIntConstant ((uint) Value, Location);
+ }
+ if (target_type == TypeManager.int64_type) {
+ if (in_checked_context){
+ if (Value < long.MinValue || Value > long.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new LongConstant ((long) Value, Location);
+ }
+ if (target_type == TypeManager.uint64_type) {
+ if (in_checked_context){
+ if (Value < ulong.MinValue || Value > ulong.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new ULongConstant ((ulong) Value, Location);
+ }
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) Value, Location);
+ if (target_type == TypeManager.char_type) {
+ if (in_checked_context){
+ if (Value < (double) char.MinValue || Value > (double) char.MaxValue || double.IsNaN (Value))
+ throw new OverflowException ();
+ }
+ return new CharConstant ((char) Value, Location);
+ }
+ if (target_type == TypeManager.decimal_type)
+ return new DecimalConstant ((decimal) Value, Location);