Exemple #1
0
        //------------------------------------------------------------
        // MetaDataHelper.GetFullName
        //
        /// <summary>
        /// Returns a fully-qualified name (open type, do not pass TYPESYMs)
        /// With inner types denoted with m_chNested (defaults to '+')
        /// And everything else separated by dots (.)
        /// </summary>
        /// <param name="sym"></param>
        /// <param name="strBuilder"></param>
        /// <param name="innerSym"></param>
        //------------------------------------------------------------
        public void GetFullName(
            SYM sym,
            StringBuilder strBuilder,
            SYM innerSym)       // = null
        {
            // Special case -- the root namespace.
            if (sym.ParentSym == null)
            {
                // At the root namespace.
                return;
            }

            if (sym.IsTYPESYM)
            {
                DebugUtil.Assert(false, "MetaDataHelper::GetFullName should not be called on TYPESYMs");
                return;
            }

            PARENTSYM parentSym = sym.ParentSym;

            // If Our parent isn't the root, get the parent name and separator and advance beyond it.
            if (parentSym.ParentSym != null)
            {
                GetFullName(parentSym, strBuilder, sym);
                strBuilder.Append(parentSym.IsAGGSYM ? this.nested : ".");
            }

            // Get the current name and add it on
            string name;

            if (sym.IsPROPSYM)
            {
                name = (sym as PROPSYM).GetRealName();
            }
            else
            {
                name = sym.Name;
            }

            int ichMin = strBuilder.Length;

            if (name == null)
            {
                GetExplicitImplName(sym, strBuilder);
            }
            else
            {
                strBuilder.Append(name);
            }

            EscapeSpecialChars(strBuilder);
            GetTypeVars(sym, strBuilder, innerSym);
        }
Exemple #2
0
        //------------------------------------------------------------
        // FUNCBREC.CreateNewLocVarSym
        //
        /// <summary>Increments the following values:
        /// FUNCBREC.localCount,
        /// FUNCBREC.unreferencedVarCount and
        /// FUNCBREC.uninitedVarCount.
        /// And sets LOCVARSYM.LocSlotInfo.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="typeSym"></param>
        /// <param name="parentSym"></param>
        /// <returns></returns>
        //------------------------------------------------------------
        internal LOCVARSYM CreateNewLocVarSym(
            string name,
            TYPESYM typeSym,
            PARENTSYM parentSym)
        {
            SYM sym = Compiler.LocalSymbolManager.LookupLocalSym(
                name,
                parentSym,
                SYMBMASK.LOCVARSYM);

            if (sym != null)
            {
                return(sym as LOCVARSYM);
            }

            LOCVARSYM locSym = Compiler.LocalSymbolManager.CreateLocalSym(
                SYMKIND.LOCVARSYM,
                name,
                parentSym) as LOCVARSYM;

            locSym.TypeSym = typeSym;

            StoreInCache(null, name, locSym, null, true);

            ++this.localCount;
            if (this.localCount > 0xffff)
            {
                Compiler.Error(treeNode, CSCERRID.ERR_TooManyLocals);
            }
            ++this.unreferencedVarCount;

            locSym.LocSlotInfo.SetJbitDefAssg(this.uninitedVarCount + 1);
            int cbit = FlowChecker.GetCbit(Compiler, locSym.TypeSym);

            this.uninitedVarCount += cbit;

            return(locSym);
        }