Beispiel #1
0
        public ErrorType GetErrorType(
            Name nameText,
            TypeArray typeArgs)
        {
            Debug.Assert(nameText != null);
            if (typeArgs == null)
            {
                typeArgs = BSYMMGR.EmptyTypeArray();
            }

            Name name = _BSymmgr.GetNameFromPtrs(nameText, typeArgs);

            Debug.Assert(name != null);

            ErrorType pError = _typeTable.LookupError(name);

            if (pError == null)
            {
                // No existing error symbol. Create a new one.
                pError = _typeFactory.CreateError(name, nameText, typeArgs);
                pError.SetErrors(true);
                _typeTable.InsertError(name, pError);
            }
            else
            {
                Debug.Assert(pError.HasErrors());
                Debug.Assert(pError.nameText == nameText);
                Debug.Assert(pError.typeArgs == typeArgs);
            }

            return(pError);
        }
Beispiel #2
0
        public TypeManager()
        {
            _predefTypes = null; // Initialized via the Init call.
            _BSymmgr = null; // Initialized via the Init call.
            _typeFactory = new TypeFactory();
            _typeTable = new TypeTable();

            // special types with their own symbol kind.
            _errorType = _typeFactory.CreateError(null, null, null, null, null);
            _voidType = _typeFactory.CreateVoid();
            _nullType = _typeFactory.CreateNull();
            _typeUnit = _typeFactory.CreateUnit();
            _typeAnonMeth = _typeFactory.CreateAnonMethod();
            _typeMethGrp = _typeFactory.CreateMethodGroup();
            _argListType = _typeFactory.CreateArgList();

            InitType(_errorType);
            _errorType.SetErrors(true);

            InitType(_voidType);
            InitType(_nullType);
            InitType(_typeUnit);
            InitType(_typeAnonMeth);
            InitType(_typeMethGrp);

            _stvcMethod = new StdTypeVarColl();
            _stvcClass = new StdTypeVarColl();
        }
Beispiel #3
0
        public TypeManager()
        {
            _predefTypes = null; // Initialized via the Init call.
            _BSymmgr     = null; // Initialized via the Init call.
            _typeFactory = new TypeFactory();
            _typeTable   = new TypeTable();

            // special types with their own symbol kind.
            _errorType    = _typeFactory.CreateError(null, null, null, null, null);
            _voidType     = _typeFactory.CreateVoid();
            _nullType     = _typeFactory.CreateNull();
            _typeUnit     = _typeFactory.CreateUnit();
            _typeAnonMeth = _typeFactory.CreateAnonMethod();
            _typeMethGrp  = _typeFactory.CreateMethodGroup();
            _argListType  = _typeFactory.CreateArgList();

            InitType(_errorType);
            _errorType.SetErrors(true);

            InitType(_voidType);
            InitType(_nullType);
            InitType(_typeUnit);
            InitType(_typeAnonMeth);
            InitType(_typeMethGrp);

            _stvcMethod = new StdTypeVarColl();
            _stvcClass  = new StdTypeVarColl();
        }
Beispiel #4
0
        public ErrorType GetErrorType(
            CType pParentType,
            AssemblyQualifiedNamespaceSymbol pParentNS,
            Name nameText,
            TypeArray typeArgs)
        {
            Debug.Assert(nameText != null);
            Debug.Assert(pParentType == null || pParentNS == null);
            if (pParentType == null && pParentNS == null)
            {
                // Use the root namespace as the parent.
                pParentNS = _BSymmgr.GetRootNsAid();
            }
            if (typeArgs == null)
            {
                typeArgs = BSYMMGR.EmptyTypeArray();
            }

            Name name = _BSymmgr.GetNameFromPtrs(nameText, typeArgs);

            Debug.Assert(name != null);

            ErrorType pError = null;

            if (pParentType != null)
            {
                pError = _typeTable.LookupError(name, pParentType);
            }
            else
            {
                Debug.Assert(pParentNS != null);
                pError = _typeTable.LookupError(name, pParentNS);
            }

            if (pError == null)
            {
                // No existing error symbol. Create a new one.
                pError = _typeFactory.CreateError(name, pParentType, pParentNS, nameText, typeArgs);
                pError.SetErrors(true);
                if (pParentType != null)
                {
                    _typeTable.InsertError(name, pParentType, pError);
                }
                else
                {
                    _typeTable.InsertError(name, pParentNS, pError);
                }
            }
            else
            {
                Debug.Assert(pError.HasErrors());
                Debug.Assert(pError.nameText == nameText);
                Debug.Assert(pError.typeArgs == typeArgs);
            }

            return(pError);
        }
Beispiel #5
0
        public TypeManager(BSYMMGR bsymmgr, PredefinedTypes predefTypes)
        {
            _typeFactory = new TypeFactory();
            _typeTable   = new TypeTable();

            // special types with their own symbol kind.
            _errorType   = _typeFactory.CreateError(null, null, null);
            _voidType    = _typeFactory.CreateVoid();
            _nullType    = _typeFactory.CreateNull();
            _typeMethGrp = _typeFactory.CreateMethodGroup();
            _argListType = _typeFactory.CreateArgList();

            _errorType.SetErrors(true);

            _stvcMethod  = new StdTypeVarColl();
            _stvcClass   = new StdTypeVarColl();
            _BSymmgr     = bsymmgr;
            _predefTypes = predefTypes;
        }
Beispiel #6
0
        public ErrorType GetErrorType(Name nameText)
        {
            Debug.Assert(nameText != null);
            ErrorType pError = _typeTable.LookupError(nameText);

            if (pError == null)
            {
                // No existing error symbol. Create a new one.
                pError = _typeFactory.CreateError(nameText);
                pError.SetErrors(true);
                _typeTable.InsertError(nameText, pError);
            }
            else
            {
                Debug.Assert(pError.HasErrors());
                Debug.Assert(pError.nameText == nameText);
            }

            return(pError);
        }