/*-------------------- Constructors ---------------------------------*/ internal ClassSpec(Class clType, Type[] gPars) { Contract.Requires(clType != null); Contract.Requires(gPars != null); 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(); fields.Add(new FieldRef(this, ((Field)classFields[i]).Name(), fType)); } }
internal void AddMethod(MethodRef meth) { Contract.Requires(meth != null); MethodRef m = (MethodRef)GetMethodDesc(meth.Name(), meth.GetParTypes()); if (m == null) { methods.Add(meth); meth.SetParent(this); } }
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); } } }