public override Constant ConvertExplicitly (bool in_checked_context, TypeSpec target_type)
{
switch (target_type.BuiltinType) {
case BuiltinTypeSpec.Type.SByte:
return new SByteConstant (target_type, (sbyte) Value, loc);
case BuiltinTypeSpec.Type.Byte:
return new ByteConstant (target_type, (byte) Value, loc);
case BuiltinTypeSpec.Type.Short:
return new ShortConstant (target_type, (short) Value, loc);
case BuiltinTypeSpec.Type.UShort:
return new UShortConstant (target_type, (ushort) Value, loc);
case BuiltinTypeSpec.Type.Int:
return new IntConstant (target_type, (int) Value, loc);
case BuiltinTypeSpec.Type.UInt:
return new UIntConstant (target_type, (uint) Value, loc);
case BuiltinTypeSpec.Type.Long:
return new LongConstant (target_type, (long) Value, loc);
case BuiltinTypeSpec.Type.ULong:
return new ULongConstant (target_type, (ulong) Value, loc);
case BuiltinTypeSpec.Type.Char:
return new CharConstant (target_type, (char) Value, loc);
case BuiltinTypeSpec.Type.Float:
return new FloatConstant (target_type, (float) Value, loc);
case BuiltinTypeSpec.Type.Double:
return new DoubleConstant (target_type, (double) Value, loc);
}
return null;
}