Esempio n. 1
0
        internal override sealed void BuildTables(MetaDataOut md)
        {
            md.AddToTable(MDTable.Method, this);
            nameIx = md.AddToStringsHeap(name);

            if (genericParams != null)
            {
                foreach (object genericParam in genericParams)
                {
                    ((GenericParam)genericParam).BuildMDTables(md);
                }
            }
            if (security != null)
            {
                foreach (object sec in security)
                {
                    ((DeclSecurity)sec).BuildMDTables(md);
                }
            }
            if (pinvokeImpl != null) pinvokeImpl.BuildMDTables(md);
            if (entryPoint) md.SetEntryPoint(this);
            if (locals != null)
            {
                localSig = new LocalSig(locals);
                localSig.BuildMDTables(md);
            }

              // The following code is done out of line in method
              // TraverseCode *after* all the method indices have
              // been allocated in the metadata.
              // (kjg, March 2010)
            //try {
            //  if (code != null) {
            //    if (code.IsEmpty()) {
            //      code = null;
            //    }
            //    else {
            //      code.BuildTables(md);
            //    }
            //  }
            //}
            //catch (InstructionException ex) {
            //  throw new Exception(ex.AddMethodName(name));
            //}

            parIx = md.TableIndex(MDTable.Param);
            for (int i = 0; i < sig.numPars; i++)
            {
                parList[i].seqNo = (ushort)(i + 1);
                parList[i].BuildMDTables(md);
            }
            sig.BuildTables(md);
        }
Esempio n. 2
0
 internal static void Read(PEReader buff, TableRow[] sigs)
 {
     for (int i = 0; i < sigs.Length; i++)
     {
         uint sigIx = buff.GetBlobIx();
         uint tag = buff.FirstBlobByte(sigIx);
         if (tag == LocalSig.LocalSigByte)
             sigs[i] = new LocalSig(sigIx);
         else if (tag == Field.FieldTag)
             sigs[i] = new Signature(sigIx);
         else
             sigs[i] = new CalliSig(sigIx);
         sigs[i].Row = (uint)i + 1;
     }
 }