示例#1
0
文件: PERWAPI.cs 项目: nomit007/f4
 internal Method GetMethod(MethSig mSig)
 {
     return GetMethodDesc(mSig.name,mSig.parTypes,mSig.optParTypes);
 }
示例#2
0
文件: PERWAPI.cs 项目: nomit007/f4
 /// <summary>
 /// Add a method to this class
 /// </summary>
 /// <param name="name">method name</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">parameters</param>
 /// <returns>a descriptor for this new method</returns>
 public MethodDef AddMethod(string name, Type retType, Param[] pars)
 {
     System.Diagnostics.Debug.Assert(retType != null);
     MethSig mSig = new MethSig(name);
     mSig.SetParTypes(pars);
     MethodDef meth = (MethodDef)GetMethod(mSig);
     if (meth != null)
         throw new DescriptorException("Method " + meth.NameString());
     mSig.retType = retType;
     meth = new MethodDef(this,mSig,pars);
     methods.Add(meth);
     return meth;
 }
示例#3
0
文件: PERWAPI.cs 项目: nomit007/f4
 internal MethodRef GetMethod(MethSig mSig)
 {
     return (MethodRef)defaultClass.GetMethod(mSig);
 }
示例#4
0
文件: PERWAPI.cs 项目: nomit007/f4
 private MethSig ReadMethSig(Method currMeth, bool firstByteRead)
 {
     //Class currClass = null;
     //if (currMeth != null) currClass = (Class)currMeth.GetParent();
     MethSig meth = new MethSig(null);
     if (!firstByteRead) {
         byte firstByte = blob.ReadByte();
         if (firstByte == Field.FieldTag)
             return null;
         meth.callConv =(CallConv)firstByte;
     }
     if ((meth.callConv & CallConv.Generic) != 0){
         meth.numGenPars = blob.ReadCompressedNum();
         if (currMeth is MethodRef) {
             ((MethodRef)currMeth).MakeGenericPars(meth.numGenPars);
         } //else if (currMeth is MethodDef) {
         //GetGenericParams((MethodDef)currMeth);
         //}
     }
     uint parCount = blob.ReadCompressedNum();
     if (Diag.DiagOn) Console.WriteLine("Method sig has " + parCount + " parameters");
     meth.retType = GetBlobType();//currClass,currMeth);
     if (meth.retType == null)
         System.Diagnostics.Debug.Assert(meth.retType != null);
     int optParStart = -1;
     ArrayList pTypes = new ArrayList();
     for (int i=0; i < parCount; i++) {
         Type pType = GetBlobType();//currClass,currMeth);
         if (pType == sentinel) {
             optParStart = i;
             pType = GetBlobType();//currClass,currMeth);
         }
         if (Diag.DiagOn) if (pType == null) Console.WriteLine("Param type is null");
         pTypes.Add(pType);
     }
     if (optParStart > -1) {
         meth.numPars = (uint)optParStart;
         meth.numOptPars = parCount - meth.numPars;
         meth.optParTypes = new Type[meth.numOptPars];
         for (int i=0; i < meth.numOptPars; i++) {
             meth.optParTypes[i] = (Type)pTypes[i+optParStart];
         }
     } else
         meth.numPars = parCount;
     meth.parTypes = new Type[meth.numPars];
     for (int i=0; i < meth.numPars; i++) {
         meth.parTypes[i] = (Type)pTypes[i];
     }
     return meth;
 }
示例#5
0
文件: PERWAPI.cs 项目: nomit007/f4
 internal MethPtrType(MethSig msig)
     : base((byte)ElementType.FnPtr)
 {
     mSig = msig;
 }
示例#6
0
文件: PERWAPI.cs 项目: nomit007/f4
 internal MethSig InstantiateGenTypes(Class classType, Type[] genTypes)
 {
     MethSig newSig = new MethSig(name);
     newSig.callConv = callConv;
     newSig.numPars = numPars;
     newSig.numOptPars = numOptPars;
     newSig.numGenPars = numGenPars;
     newSig.parTypes = ReplaceGenPars(parTypes,classType,genTypes);
     newSig.optParTypes = ReplaceGenPars(optParTypes,classType,genTypes);
     newSig.retType = SubstituteType(retType,classType,genTypes);
     return newSig;
 }
示例#7
0
文件: PERWAPI.cs 项目: nomit007/f4
 internal MethodRef(MethSig sig)
     : base(sig.name)
 {
     this.sig = sig;
 }
示例#8
0
文件: PERWAPI.cs 项目: nomit007/f4
 /// <summary>
 /// Make a method reference descriptor for this method to be used
 /// as a callsite signature for this vararg method
 /// </summary>
 /// <param name="optPars">the optional pars for the vararg method call</param>
 /// <returns></returns>
 public MethodRef MakeVarArgSignature(Type[] optPars)
 {
     MethSig mSig = new MethSig(name);
     mSig.parTypes = sig.parTypes;
     mSig.retType = sig.retType;
     varArgSig = new MethodRef(sig);
     varArgSig.MakeVarArgMethod(this,optPars);
     return varArgSig;
 }
示例#9
0
文件: PERWAPI.cs 项目: nomit007/f4
 internal MethodDef(ClassSpec paren, MethSig mSig, Param[] pars)
     : base(mSig.name)
 {
     parent = paren;
     parList = pars;
     sig = mSig;
     tabIx = MDTable.Method;
 }
示例#10
0
文件: PERWAPI.cs 项目: nomit007/f4
 internal void SetSig(MethSig sig)
 {
     this.sig = sig;
     this.sig.name = name;
 }
示例#11
0
文件: PERWAPI.cs 项目: nomit007/f4
 /*-------------------- Constructors ---------------------------------*/
 internal Method(string methName, Type rType, Class paren)
     : base(methName,paren)
 {
     sig = new MethSig(methName);
     sig.retType = rType;
 }