private bool bindImplicitConversionFromNull()
{
// null type can be implicitly converted to any reference type or pointer type or type
// variable with reference-type constraint.
FUNDTYPE ftDest = _typeDest.FundamentalType;
if (ftDest != FUNDTYPE.FT_REF && ftDest != FUNDTYPE.FT_PTR &&
// null is convertible to System.Nullable<T>.
!_typeDest.IsPredefType(PredefinedType.PT_G_OPTIONAL))
{
return false;
}
if (_needsExprDest)
{
// If the conversion argument is a constant null then return a ZEROINIT.
// Otherwise, bind this as a cast to the destination type. In a later
// rewrite pass we will rewrite the cast as SEQ(side effects, ZEROINIT).
_exprDest = _exprSrc is ExprConstant
? ExprFactory.CreateZeroInit(_typeDest)
: ExprFactory.CreateCast(_typeDest, _exprSrc);
}
return true;
}