Esempio n. 1
0
 /// <summary>
 /// Add a method to this class
 /// </summary>
 /// <param name="mAtts">attributes for this method</param>
 /// <param name="iAtts">implementation attributes for this method</param>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">parameters</param>
 /// <returns>a descriptor for this new method</returns>
 public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name,
     GenericParam[] genPars, Type retType, Param[] pars)
 {
     Contract.Requires(name != null);
     Contract.Requires(genPars != null);
     Contract.Requires(retType != null);
     Contract.Requires(pars != null);
     MethodDef meth = AddMethod(name, genPars, retType, pars);
     meth.AddMethAttribute(mAtts);
     meth.AddImplAttribute(iAtts);
     return meth;
 }
Esempio n. 2
0
 public GenericParam AddGenericParam(string name)
 {
     GenericParam gp = new GenericParam(name, this, genericParams.Count);
     genericParams.Add(gp);
     return gp;
 }
Esempio n. 3
0
 /// <summary>
 /// Add a method to this class
 /// </summary>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</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, GenericParam[] genPars, Type retType, Param[] pars)
 {
     Contract.Requires(name != null);
     Contract.Requires(genPars != null);
     Contract.Requires(retType != null);
     Contract.Requires(pars != null);
     MethodDef meth = AddMethod(name, retType, pars);
     if ((genPars != null) && (genPars.Length > 0))
     {
         for (int i = 0; i < genPars.Length; i++)
         {
             genPars[i].SetMethParam(meth, i);
         }
         meth.SetGenericParams(genPars);
     }
     return meth;
 }
Esempio n. 4
0
 /// <summary>
 /// Add a "global" method to this module
 /// </summary>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">method parameters</param>
 /// <returns>a descriptor for this new "global" method</returns>
 public MethodDef AddMethod(string name, GenericParam[] genPars, Type retType, Param[] pars)
 {
     MethodDef newMeth = defaultClass.AddMethod(name, genPars, retType, pars);
     return newMeth;
 }
Esempio n. 5
0
 /// <summary>
 /// Add a "global" method to this module
 /// </summary>
 /// <param name="mAtts">method attributes</param>
 /// <param name="iAtts">method implementation attributes</param>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">method parameters</param>
 /// <returns>a descriptor for this new "global" method</returns>
 public MethodDef AddMethod(MethAttr mAtts, ImplAttr iAtts, string name, GenericParam[] genPars, Type retType, Param[] pars)
 {
     //FIXME Contract.Requires(defaultClass != null);
     MethodDef newMeth = defaultClass.AddMethod(mAtts, iAtts, name, genPars, retType, pars);
     return newMeth;
 }
Esempio n. 6
0
 /// <summary>
 /// Add a method to this class
 /// </summary>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">parameter types</param>
 /// <param name="optPars">optional parameter types</param>
 /// <returns>a descriptor for this method</returns>
 public MethodRef AddVarArgMethod(string name, GenericParam[] genPars, Type retType, Type[] pars, Type[] optPars)
 {
     MethodRef meth = AddMethod(name, genPars, retType, pars);
     meth.MakeVarArgMethod(null, optPars);
     return meth;
 }
Esempio n. 7
0
 /// <summary>
 /// Add a generic type to this method
 /// </summary>
 /// <param name="name">the name of the generic type</param>
 /// <returns>the descriptor for the generic type</returns>
 public GenericParam AddGenericParam(string name)
 {
     if (genericParams == null) genericParams = new ArrayList();
     GenericParam gp = new GenericParam(name, this, genericParams.Count);
     sig.callConv |= CallConv.Generic;
     genericParams.Add(gp);
     sig.numGenPars = (uint)genericParams.Count;
     return gp;
 }
Esempio n. 8
0
 internal void AddGenericParam(GenericParam par)
 {
     if (genericParams == null) genericParams = new ArrayList();
     genericParams.Add(par);
     //sig.callConv |= CallConv.Generic;
     //sig.numGenPars = (uint)genericParams.Count;
 }
Esempio n. 9
0
 internal void SetGenericParams(GenericParam[] pars)
 {
     genericParams = new ArrayList(pars);
     sig.callConv |= CallConv.Generic;
     sig.numGenPars = (uint)genericParams.Count;
 }
Esempio n. 10
0
 internal GenericParTypeSpec(GenericParam gPar)
     : base(gPar.GetTypeIndex())
 {
     Contract.Requires(gPar != null);
     this.gPar = gPar;
 }
Esempio n. 11
0
 internal GenericParam GetGenericParam(MethodDef meth)
 {
     Contract.Requires(meth != null);
     if (gPar == null)
     {
         if (isClassPar)
         {
             ClassDef methClass = (ClassDef)meth.GetParent();
             gPar = methClass.GetGenericParam((int)index);
         }
         else
         {
             gPar = meth.GetGenericParam((int)index);
         }
     }
     return gPar;
 }
Esempio n. 12
0
 internal static void Read(PEReader buff, TableRow[] gpars)
 {
     Contract.Requires(buff != null);
     Contract.Requires(gpars != null);
     for (int i = 0; i < gpars.Length; i++)
         gpars[i] = new GenericParam(buff);
 }
Esempio n. 13
0
 internal override void Resolve(PEReader buff)
 {
     parent = (GenericParam)buff.GetElement(MDTable.GenericParam, parentIx);
     parent.AddConstraint((Type)buff.GetCodedElement(CIx.TypeDefOrRef, constraintIx));
 }
Esempio n. 14
0
 //public GenericParamConstraint(GenericParam parent, Class constraint)
 // Class constraint;
 /*-------------------- Constructors ---------------------------------*/
 public GenericParamConstraint(GenericParam parent, Type constraint)
 {
     this.parent = parent;
     this.constraint = constraint;
     tabIx = MDTable.GenericParamConstraint;
 }
Esempio n. 15
0
 public virtual void SetGenericParams(GenericParam[] genPars)
 {
     Contract.Requires(genPars != null);
     for (int i = 0; i < genPars.Length; i++)
     {
         genPars[i].SetClassParam(this, i);
     }
     genericParams = new ArrayList(genPars);
 }
Esempio n. 16
0
 internal void InsertGenericParam(GenericParam genPar)
 {
     if (genericParams == null) genericParams = new ArrayList();
     for (int i = 0; i < genericParams.Count - genPar.Index; i++)
     {
         genericParams.Add(null);
     }
     genericParams.Insert((int)genPar.Index, genPar);
 }
Esempio n. 17
0
 internal void AddGenericParam(GenericParam par)
 {
     Contract.Requires(par != null);
     genericParams.Add(par);
     //par.SetClassParam(this,genericParams.Count-1);
 }
Esempio n. 18
0
 /// <summary>
 /// Add a method to this class
 /// </summary>
 /// <param name="name">method name</param>
 /// <param name="genPars">generic parameters</param>
 /// <param name="retType">return type</param>
 /// <param name="pars">parameter types</param>
 /// <returns>a descriptor for this method</returns>
 public MethodRef AddMethod(string name, GenericParam[] genPars, Type retType, Type[] pars)
 {
     MethodRef meth = AddMethod(name, retType, pars);
     if ((genPars != null) && (genPars.Length > 0))
     {
         for (int i = 0; i < genPars.Length; i++)
         {
             genPars[i].SetMethParam(meth, i);
         }
         meth.SetGenericParams(genPars);
     }
     return meth;
 }