Exemple #1
0
 internal Method GetMethod(MethSig mSig)
 {
     return GetMethodDesc(mSig.name,mSig.parTypes,mSig.optParTypes);
 }
Exemple #2
0
 /// <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;
 }
Exemple #3
0
 internal MethodRef GetMethod(MethSig mSig)
 {
     return (MethodRef)defaultClass.GetMethod(mSig);
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 internal MethPtrType(MethSig msig)
     : base((byte)ElementType.FnPtr)
 {
     mSig = msig;
 }
Exemple #6
0
 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;
 }
Exemple #7
0
 internal MethodRef(MethSig sig)
     : base(sig.name)
 {
     this.sig = sig;
 }
Exemple #8
0
 /// <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;
 }
Exemple #9
0
 internal MethodDef(ClassSpec paren, MethSig mSig, Param[] pars)
     : base(mSig.name)
 {
     parent = paren;
     parList = pars;
     sig = mSig;
     tabIx = MDTable.Method;
 }
Exemple #10
0
 internal void SetSig(MethSig sig)
 {
     this.sig = sig;
     this.sig.name = name;
 }
Exemple #11
0
 /*-------------------- Constructors ---------------------------------*/
 internal Method(string methName, Type rType, Class paren)
     : base(methName,paren)
 {
     sig = new MethSig(methName);
     sig.retType = rType;
 }