Ejemplo n.º 1
0
        internal sealed override 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);
        }