Microsoft.CSharp.RuntimeBinder.Semantics.NullableType.GetAts C# (CSharp) Method

GetAts() public method

public GetAts ( ErrorHandling errorContext ) : AggregateType
errorContext Microsoft.CSharp.RuntimeBinder.Errors.ErrorHandling
return AggregateType
        public AggregateType GetAts(ErrorHandling errorContext)
        {
            AggregateSymbol aggNullable = typeManager.GetNullable();
            if (aggNullable == null)
            {
                throw Error.InternalCompilerError();
            }

            if (ats == null)
            {
                CType typePar = GetUnderlyingType();
                CType[] typeParArray = new CType[] { typePar };
                TypeArray ta = symmgr.AllocParams(1, typeParArray);
                ats = typeManager.GetAggregate(aggNullable, ta);
            }
            return ats;
        }
        public CType GetUnderlyingType() { return UnderlyingType; }

Usage Example

Esempio n. 1
0
        // 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));
        }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.NullableType::GetAts