public override Constant ConvertExplicitly (bool inCheckedContext, TypeSpec targetType)
{
if (targetType.IsPointer) {
if (IsLiteral || this is NullPointer)
return new NullPointer (targetType, loc);
return null;
}
// Exlude internal compiler types
if (targetType.Kind == MemberKind.InternalCompilerType && targetType.BuiltinType != BuiltinTypeSpec.Type.Dynamic)
return null;
if (!IsLiteral && !Convert.ImplicitStandardConversionExists (this, targetType))
return null;
if (TypeSpec.IsReferenceType (targetType))
return new NullConstant (targetType, loc);
if (targetType.IsNullableType)
return Nullable.LiftedNull.Create (targetType, loc);
return null;
}