Exemple #1
0
        public AggregateType GetAggregate(AggregateSymbol agg, TypeArray typeArgsAll)
        {
            Debug.Assert(typeArgsAll != null && typeArgsAll.Count == agg.GetTypeVarsAll().Count);

            if (typeArgsAll.Count == 0)
            {
                return(agg.getThisType());
            }

            AggregateSymbol aggOuter = agg.GetOuterAgg();

            if (aggOuter == null)
            {
                return(GetAggregate(agg, null, typeArgsAll));
            }

            int cvarOuter = aggOuter.GetTypeVarsAll().Count;

            Debug.Assert(cvarOuter <= typeArgsAll.Count);

            TypeArray     typeArgsOuter = _BSymmgr.AllocParams(cvarOuter, typeArgsAll, 0);
            TypeArray     typeArgsInner = _BSymmgr.AllocParams(agg.GetTypeVars().Count, typeArgsAll, cvarOuter);
            AggregateType atsOuter      = GetAggregate(aggOuter, typeArgsOuter);

            return(GetAggregate(agg, atsOuter, typeArgsInner));
        }
Exemple #2
0
        public AggregateType GetAts()
        {
            if (ats == null)
            {
                AggregateSymbol aggNullable  = typeManager.GetNullable();
                CType           typePar      = GetUnderlyingType();
                CType[]         typeParArray = { typePar };
                TypeArray       ta           = symmgr.AllocParams(1, typeParArray);
                ats = typeManager.GetAggregate(aggNullable, ta);
            }

            return(ats);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        public AggregateType GetAts(ErrorHandling errorContext)
        {
            AggregateSymbol aggNullable = typeManager.GetNullable();

            if (aggNullable == null)
            {
                throw Error.InternalCompilerError();
            }

            if (ats == null)
            {
                if (aggNullable == null)
                {
                    typeManager.ReportMissingPredefTypeError(errorContext, PredefinedType.PT_G_OPTIONAL);
                    return(null);
                }

                CType     typePar      = GetUnderlyingType();
                CType[]   typeParArray = new CType[] { typePar };
                TypeArray ta           = symmgr.AllocParams(1, typeParArray);
                ats = typeManager.GetAggregate(aggNullable, ta);
            }
            return(ats);
        }
Exemple #5
0
 public AggregateType GetAts() => _ats ?? (_ats = _typeManager.GetAggregate(
                                               _typeManager.GetNullable(), _symmgr.AllocParams(UnderlyingType)));