GetAggregate() public method

public GetAggregate ( AggregateSymbol agg, AggregateType atsOuter, TypeArray typeArgs ) : AggregateType
agg AggregateSymbol
atsOuter AggregateType
typeArgs TypeArray
return AggregateType
Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public AggregateType getThisType()
        {
            if (_atsInst == null)
            {
                Debug.Assert(GetTypeVars() == GetTypeVarsAll() || isNested());

                AggregateType pOuterType = isNested() ? GetOuterAgg().getThisType() : null;

                _atsInst = TypeManager.GetAggregate(this, pOuterType, GetTypeVars());
            }

            //Debug.Assert(GetTypeVars().Size == atsInst.GenericArguments.Count);
            return(_atsInst);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        private static CType LoadTypeFromSignature(int[] signature, ref int indexIntoSignatures, TypeArray classTyVars)
        {
            Debug.Assert(signature != null);

            MethodSignatureEnum current = (MethodSignatureEnum)signature[indexIntoSignatures];

            indexIntoSignatures++;

            switch (current)
            {
            case MethodSignatureEnum.SIG_SZ_ARRAY:
                return(TypeManager.GetArray(LoadTypeFromSignature(signature, ref indexIntoSignatures, classTyVars), 1, true));

            case MethodSignatureEnum.SIG_METH_TYVAR:
                return(TypeManager.GetStdMethTypeVar(signature[indexIntoSignatures++]));

            case MethodSignatureEnum.SIG_CLASS_TYVAR:
                return(classTyVars[signature[indexIntoSignatures++]]);

            case (MethodSignatureEnum)PredefinedType.PT_VOID:
                return(VoidType.Instance);

            default:
                Debug.Assert(current >= 0 && (int)current < (int)PredefinedType.PT_COUNT);
                AggregateSymbol agg       = GetPredefAgg((PredefinedType)current);
                int             typeCount = agg.GetTypeVars().Count;
                if (typeCount == 0)
                {
                    return(TypeManager.GetAggregate(agg, TypeArray.Empty));
                }

                CType[] typeArgs = new CType[typeCount];
                for (int iTypeArg = 0; iTypeArg < typeArgs.Length; iTypeArg++)
                {
                    typeArgs[iTypeArg] = LoadTypeFromSignature(signature, ref indexIntoSignatures, classTyVars);
                }

                return(TypeManager.GetAggregate(agg, TypeArray.Allocate(typeArgs)));
            }
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
 public AggregateType GetAts() => _ats ?? (_ats = _typeManager.GetAggregate(
                                               _typeManager.GetNullable(), _symmgr.AllocParams(UnderlyingType)));
Exemplo n.º 7
0
 public override AggregateType GetAts() =>
 _ats ?? (_ats = TypeManager.GetAggregate(TypeManager.GetNullable(), TypeArray.Allocate(UnderlyingType)));