Esempio n. 1
0
 //------------------------------------------------------------
 // MethPropWithInst Constructor (2)
 //
 /// <summary></summary>
 /// <param name="mps"></param>
 /// <param name="ats"></param>
 /// <param name="TypeArguments"></param>
 //------------------------------------------------------------
 internal MethPropWithInst(
     METHPROPSYM mps,
     AGGTYPESYM ats,
     TypeArray TypeArguments)    // = NULL)
 {
     Set(mps, ats, TypeArguments);
 }
Esempio n. 2
0
        //------------------------------------------------------------
        // MethPropWithInst.Set (1)
        //
        /// <summary></summary>
        /// <param name="mps"></param>
        /// <param name="ats"></param>
        /// <param name="TypeArguments"></param>
        //------------------------------------------------------------
        internal void Set(METHPROPSYM mps, AGGTYPESYM ats, TypeArray TypeArguments)
        {
            if (mps == null)
            {
                ats           = null;
                TypeArguments = null;
            }

            DebugUtil.Assert(
                ats == null ||
                mps != null && mps.ClassSym == ats.GetAggregate());
            DebugUtil.Assert(
                TypeArguments == null ||
                TypeArguments.Count == 0 ||
                mps != null && mps.IsMETHSYM);
            DebugUtil.Assert(
                TypeArguments == null ||
                !mps.IsMETHSYM ||
                (mps as METHSYM).TypeVariables.Count == TypeArguments.Count);

            this.Sym           = mps;
            this.AggTypeSym    = ats;
            this.TypeArguments = TypeArguments;
        }
Esempio n. 3
0
 //------------------------------------------------------------
 // MethPropWithType Constructor (2)
 //
 /// <summary></summary>
 /// <param name="mps"></param>
 /// <param name="ats"></param>
 //------------------------------------------------------------
 internal MethPropWithType(METHPROPSYM mps, AGGTYPESYM ats)
 {
     Set(mps, ats);
 }
Esempio n. 4
0
 //------------------------------------------------------------
 // MethPropWithType.Set (1)
 //
 /// <summary></summary
 /// <param name="mps"></param>
 /// <param name="ats"></param>
 //------------------------------------------------------------
 internal void Set(METHPROPSYM mps, AGGTYPESYM ats)
 {
     base.Set(mps, ats);
 }
Esempio n. 5
0
        //------------------------------------------------------------
        // MetaDataHelper.GetExplicitImplName
        //
        /// <summary>
        /// Get a synthesized name for explicit interface implementations.
        /// The name we use is: "InterfaceName.MethodName", where InterfaceName is the fully qualified name
        /// of the interface containing the implemented method.
        /// This name has a '.' in it, so it can't conflict with any "real" name or be confused with one.
        /// </summary>
        /// <remarks>
        /// Returns true if the buffer had enough space for the name.
        /// If not enough space, then adds as much of name as possible to buffer.
        /// Always NULL terminates buffer.
        /// </remarks>
        /// <param name="sym"></param>
        /// <param name="strBuilder"></param>
        //------------------------------------------------------------
        public void GetExplicitImplName(SYM sym, StringBuilder strBuilder)
        {
            DebugUtil.Assert(sym.IsEVENTSYM || sym.IsMETHPROPSYM);

            SymWithType swtImpl   = new SymWithType();
            ERRORSYM    errSym    = null;
            string      implName  = null;
            string      aliasName = null;

            switch (sym.Kind)
            {
            case SYMKIND.EVENTSYM:
                EVENTSYM eventSym = sym as EVENTSYM;
                DebugUtil.Assert(eventSym.IsExpImpl);
                swtImpl = eventSym.SlotEventWithType;
                errSym  = eventSym.ExpImplErrorSym;
                break;

            case SYMKIND.METHSYM:
            case SYMKIND.PROPSYM:
            {
                METHPROPSYM mpSym = sym as METHPROPSYM;
                DebugUtil.Assert(mpSym.IsExplicitImplementation);
                swtImpl = mpSym.SlotSymWithType;
                errSym  = mpSym.ExpImplErrorSym;
                BASENODE nameNode = null;

                if (sym.IsMETHSYM &&
                    (sym as METHSYM).ParseTreeNode != null &&
                    (sym as METHSYM).ParseTreeNode.Kind == NODEKIND.METHOD)
                {
                    nameNode = ((sym as METHSYM).ParseTreeNode as METHODNODE).NameNode;
                }
                else if (
                    sym.IsPROPSYM &&
                    (sym as PROPSYM).ParseTreeNode != null &&
                    (sym as PROPSYM).ParseTreeNode.Kind == NODEKIND.PROPERTY)
                {
                    nameNode = ((sym as PROPSYM).ParseTreeNode as PROPERTYNODE).NameNode;
                }

                while (nameNode != null && nameNode.Kind == NODEKIND.DOT)
                {
                    nameNode = nameNode.AsDOT.Operand1;
                }

                if (nameNode != null && nameNode.Kind == NODEKIND.ALIASNAME)
                {
                    aliasName = nameNode.AsANYNAME.Name;
                }
                if (!sym.IsPROPSYM || !(sym as PROPSYM).IsIndexer)
                {
                    break;
                }

                implName = (swtImpl != null ? (swtImpl.Sym as PROPSYM).GetRealName() : "Item");
                // fish out any user specified alias
                break;
            }

            default:
                // gcc -Wall (all warnings enabled) complains if all cases
                // aren't handled, so we explicitly handle default and assert
                DebugUtil.Assert(false);
                break;
            }

            DebugUtil.Assert(swtImpl != null || errSym != null);

            if (aliasName != null)
            {
                strBuilder.Append(aliasName);
                strBuilder.Append("::");
            }

            if (swtImpl != null)
            {
                GetExplicitImplTypeName(swtImpl.AggTypeSym, strBuilder);
                if (implName == null)
                {
                    implName = swtImpl.Sym.Name;
                }
            }
            else
            {
                GetExplicitImplTypeName(errSym, strBuilder);
            }

            if (implName != null)
            {
                // Add dot seperator.
                strBuilder.Append('.');
                strBuilder.Append(implName);
            }
        }