Esempio n. 1
0
 internal void AddMethod(MethodRef meth)
 {
     MethodRef m = (MethodRef)GetMethodDesc(meth.Name(),meth.GetParTypes());
     if (m == null) {
         methods.Add(meth);
         meth.SetParent(this);
     }
 }
Esempio n. 2
0
 /*-------------------- Constructors ---------------------------------*/
 internal ClassSpec(Class clType, Type[] gPars)
 {
     this.typeIndex = GENERICINST;
     genClass = clType;
     genericParams = new ArrayList(gPars);
     tabIx = MDTable.TypeSpec;
     typeIndex = GENERICINST;
     ArrayList classMethods = clType.GetMethodList();
     ArrayList classFields = clType.GetFieldList();
     for (int i=0; i < classMethods.Count; i++) {
         MethSig mSig = ((Method)classMethods[i]).GetSig(); //.InstantiateGenTypes(this,gPars);
         if (mSig != null) {
             MethodRef newMeth = new MethodRef(mSig);
             newMeth.SetParent(this);
             newMeth.GenericParams = ((Method)classMethods[i]).GenericParams;
             methods.Add(newMeth);
         }
     }
     for (int i=0; i < classFields.Count; i++) {
         Type fType = ((Field)classFields[i]).GetFieldType();
         //if ((fType is GenericParam) && (((GenericParam)fType).GetParent() == genClass)) {
         //  fType = gPars[((GenericParam)fType).Index];
         //}
         fields.Add(new FieldRef(this,((Field)classFields[i]).Name(),fType));
     }
 }
Esempio n. 3
0
 internal static void GetMethodRefs(PEReader buff, uint num, ClassRef parent)
 {
     for (int i=0; i < num; i++) {
         uint rva = buff.ReadUInt32();
         ushort implFlags = buff.ReadUInt16();
         ushort methFlags = buff.ReadUInt16();
         string name = buff.GetString();
         uint sigIx = buff.GetBlobIx();
         uint parIx = buff.GetIndex(MDTable.Param);
         if (IsPublicOrProtected(methFlags)) {
             MethodRef mRef = new MethodRef(parIx,name,sigIx);  // changed
             mRef.SetParent(parent);
             //Console.WriteLine(parent.NameString());
             MethSig mSig = buff.ReadMethSig(mRef,name,sigIx);
             //mSig.name = name;
             mRef.SetSig(mSig); // changed
             parent.AddToMethodList(mRef);
             //if (parent.GetMethod(mSig) == null) {
             //  MethodRef mRef = new MethodRef(mSig);
             //  parent.AddToMethodList(mRef);
             //}
         }
     }
 }