Ejemplo n.º 1
0
        MetadataToken GetCallSiteToken(CallSite cs)
        {
            uint sig;
            int  sentinel = cs.GetSentinel();

            if (sentinel > 0)
            {
                sig = m_reflectWriter.SignatureWriter.AddMethodDefSig(
                    m_reflectWriter.GetMethodDefSig(cs));
            }
            else
            {
                sig = m_reflectWriter.SignatureWriter.AddMethodRefSig(
                    m_reflectWriter.GetMethodRefSig(cs));
            }

            if (m_standaloneSigCache.Contains(sig))
            {
                return((MetadataToken)m_standaloneSigCache [sig]);
            }

            StandAloneSigTable sasTable = m_reflectWriter.MetadataTableWriter.GetStandAloneSigTable();
            StandAloneSigRow   sasRow   = m_reflectWriter.MetadataRowWriter.CreateStandAloneSigRow(sig);

            sasTable.Rows.Add(sasRow);

            MetadataToken token = new MetadataToken(TokenType.Signature, (uint)sasTable.Rows.Count);

            m_standaloneSigCache [sig] = token;
            return(token);
        }