// Value
public Expr BindValue(Expr exprSrc)
{
Debug.Assert(exprSrc != null && exprSrc.Type is NullableType);
// For new T?(x), the answer is x.
if (IsNullableConstructor(exprSrc, out ExprCall call))
{
var args = call.OptionalArguments;
Debug.Assert(args != null && !(args is ExprList));
return(args);
}
NullableType nubSrc = (NullableType)exprSrc.Type;
CType typeBase = nubSrc.GetUnderlyingType();
AggregateType ats = nubSrc.GetAts();
PropertySymbol prop = GetSymbolLoader().getBSymmgr().propNubValue;
if (prop == null)
{
prop = GetSymbolLoader().getPredefinedMembers().GetProperty(PREDEFPROP.PP_G_OPTIONAL_VALUE);
Debug.Assert(prop != null);
GetSymbolLoader().getBSymmgr().propNubValue = prop;
}
PropWithType pwt = new PropWithType(prop, ats);
MethPropWithInst mpwi = new MethPropWithInst(prop, ats);
ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(exprSrc, mpwi);
return(GetExprFactory().CreateProperty(typeBase, null, null, pMemGroup, pwt, null));
}