Exemplo n.º 1
0
        /*-------------------- Constructors ---------------------------------*/

        internal CustomAttribute(MetaDataElement paren, Method constrType,
            Constant[] val)
        {
            Contract.Requires(constrType != null);
            parent = paren;
            type = constrType;
            argVals = val;
            changed = true;
            tabIx = MDTable.CustomAttribute;
        }
Exemplo n.º 2
0
 /*----------------------------- internal functions ------------------------------*/
 internal void AddMethod(Method meth)
 {
     Contract.Requires(meth != null);
     methods.Add(meth);
     meth.SetParent(this);
 }
Exemplo n.º 3
0
 internal void AddToMethodList(Method m)
 {
     Contract.Requires(m != null);
     m.SetParent(this);
     methods.Add(m);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Remove the specified method from this class
 /// </summary>
 /// <param name="meth">method descriptor</param>
 public void RemoveMethod(Method meth)
 {
     Contract.Requires(meth != null);
     methods.Remove(meth);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Use a method as the implementation for another method (.override)
 /// </summary>
 /// <param name="decl">the method to be overridden</param>
 /// <param name="body">the implementation to be used</param>
 public void AddMethodOverride(Method decl, Method body)
 {
     methodImpls.Add(new MethodImpl(this, decl, body));
 }
Exemplo n.º 6
0
 internal override void Resolve(PEReader buff)
 {
     methParent = (Method)buff.GetCodedElement(CIx.MethodDefOrRef, parentIx);
       buff.currentMethodScope = methParent;  // set scopes - Fix by CK
       buff.currentClassScope = (Class)methParent.GetParent();
       //
       // EXPERIMENTAL: The signature of the methParent must be
       // visible as the signature of this MethodSpec.  The type-actuals
       // are held in the instTypes array.
       this.sig = this.methParent.GetSig(buff);
       instTypes = buff.ReadMethSpecSig(instIx);
       this.unresolved = false;
       //
       buff.currentMethodScope = null;
       buff.currentClassScope = null;
 }
Exemplo n.º 7
0
 internal void SetMethParam(Method paren, int ix)
 {
     typeIndex = MVAR;
     parent    = paren;
     index     = (ushort)ix;
 }
Exemplo n.º 8
0
 internal MethSig ReadMethSig(Method thisMeth, uint blobIx)
 {
     Contract.Requires(thisMeth != null);
     Contract.Ensures(Contract.Result<MethSig>() != null);
     blob.GoToIndex(blobIx);
     uint blobSize = blob.ReadCompressedNum();
     return ReadMethSig(thisMeth, false);
 }
Exemplo n.º 9
0
 internal MethSig ReadMethSig(Method thisMeth, string name, uint blobIx)
 {
     Contract.Requires(thisMeth != null);
     Contract.Requires(name != null);
     Contract.Ensures(Contract.Result<MethSig>() != null);
     blob.GoToIndex(blobIx);
     uint blobSize = blob.ReadCompressedNum();
     MethSig mSig = ReadMethSig(thisMeth, false);
     mSig.name = name;
     return mSig;
 }
Exemplo n.º 10
0
 /*-------------------- Constructors ---------------------------------*/
 public MethInstr(MethodOp inst, Method m)
     : base((uint)inst)
 {
     meth = m;
       size += 4;
 }
Exemplo n.º 11
0
 public void SetMethod(Method mth)
 {
     meth = mth;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Add an instruction with a method parameter
 /// </summary>
 /// <param name="inst">the CIL instruction</param>
 /// <param name="m">the method parameter</param>
 public void MethInst(MethodOp inst, Method m)
 {
     Contract.Requires(m != null);
       if (m is MethodDef)
     if (((MethodDef)m).GetScope() != thisMeth.GetScope())
       throw new DescriptorException();
       AddToBuffer(new MethInstr(inst, m));
 }
Exemplo n.º 13
0
 /*-------------------- Constructors ---------------------------------*/
 /// <summary>
 /// Create a new function pointer type
 /// </summary>
 /// <param name="meth">the function to be referenced</param>
 public MethPtrType(Method meth)
     : base((byte)ElementType.FnPtr)
 {
     this.meth = meth;
 }
Exemplo n.º 14
0
 internal void SetMethParam(Method paren, int ix)
 {
     typeIndex = MVAR;
     parent = paren;
     index = (ushort)ix;
 }
Exemplo n.º 15
0
        /// <summary>
        /// Open a method.  Scopes and sequence points will be added to this method.
        /// </summary>
        /// <param name="token">The token for this method.</param>
        public void OpenMethod(int token)
        {

            // Add this new method to the list of methods
            Method meth = new Method();
            meth.Token = new SymbolToken(token);
            methods.Add(meth);

            // Set the current method
            currentMethod = meth;

        }
Exemplo n.º 16
0
 private MethSig ReadMethSig(Method currMeth, bool firstByteRead)
Exemplo n.º 17
0
        /// <summary>
        /// Close the current method.
        /// </summary>
        public void CloseMethod()
        {

            // Make sure a method is open
            if (currentMethod == null)
                throw new Exception("No methods currently open.");

            // Check to make sure all scopes have been closed.
            if (currentScope != null)
                throw new Exception("Can not close method until all scopes are closed.  Method Token: " + currentMethod.Token.ToString());

            // Change the current method to null
            currentMethod = null;

        }
Exemplo n.º 18
0
 /*-------------------- Constructors ---------------------------------*/
 public MethodSpec(Method mParent, Type[] instTypes)
     : base(null)
 {
     this.methParent = mParent;
     this.instTypes = instTypes;
     tabIx = MDTable.MethodSpec;
 }
Exemplo n.º 19
0
 internal CustomAttribute(MetaDataElement paren, Method constrType,
     byte[] val)
Exemplo n.º 20
0
        /*-------------------- Constructors ---------------------------------*/

        /// <summary>
        /// Create a new function pointer type
        /// </summary>
        /// <param name="meth">the function to be referenced</param>
        public MethPtrType(Method meth)
            : base((byte)ElementType.FnPtr)
        {
            this.meth = meth;
        }