public virtual Constant ConvertImplicitly (TypeSpec type)
{
if (this.type == type)
return this;
if (!Convert.ImplicitNumericConversionExists (this.type, type))
return null;
bool fail;
object constant_value = ChangeType (GetValue (), type, out fail);
if (fail){
//
// We should always catch the error before this is ever
// reached, by calling Convert.ImplicitStandardConversionExists
//
throw new InternalErrorException ("Missing constant conversion between `{0}' and `{1}'",
Type.GetSignatureForError (), type.GetSignatureForError ());
}
return CreateConstantFromValue (type, constant_value, loc);
}