public override Constant ConvertInitializer(ResolveContext rc, Constant expr)
{
if (expr is EnumConstant)
{
expr = ((EnumConstant)expr).Child;
}
var underlying = ((Enum)Parent).UnderlyingType;
if (expr != null)
{
expr = expr.ImplicitConversionRequired(rc, underlying, Location);
if (expr != null && !IsValidEnumType(expr.Type))
{
Enum.Error_1008(Location, Report);
expr = null;
}
}
if (expr == null)
{
expr = New.Constantify(underlying, Location);
}
return(new EnumConstant(expr, MemberType));
}