//------------------------------------------------------------ // EventWithType Constructor (2) // /// <summary></summary> /// <param name="evt"></param> /// <param name="ats"></param> //------------------------------------------------------------ internal EventWithType(EVENTSYM evt, AGGTYPESYM ats) { Set(evt, ats); }
//------------------------------------------------------------ // EventWithType.Set (1) // /// <summary></summary> /// <param name="evt"></param> /// <param name="ats"></param> //------------------------------------------------------------ internal void Set(EVENTSYM evt, AGGTYPESYM ats) { base.Set(evt, ats); }
//------------------------------------------------------------ // 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); } }