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