Пример #1
0
        public override IList <PdbConstant> GetConstants(ModuleDef module, GenericParamContext gpContext)
        {
            if (constantList >= constantListEnd)
            {
                return(Array2.Empty <PdbConstant>());
            }
            Debug.Assert(constantsMetadata != null);

            var res = new PdbConstant[constantListEnd - constantList];
            int w   = 0;

            for (int i = 0; i < res.Length; i++)
            {
                uint rid = constantList + (uint)i;
                bool b   = constantsMetadata.TablesStream.TryReadLocalConstantRow(rid, out var row);
                Debug.Assert(b);
                var name = constantsMetadata.StringsStream.Read(row.Name);
                if (!constantsMetadata.BlobStream.TryCreateReader(row.Signature, out var reader))
                {
                    continue;
                }
                var localConstantSigBlobReader = new LocalConstantSigBlobReader(module, ref reader, gpContext);
                b = localConstantSigBlobReader.Read(out var type, out object value);
                Debug.Assert(b);
                if (b)
                {
                    var pdbConstant = new PdbConstant(name, type, value);
                    int token       = new MDToken(Table.LocalConstant, rid).ToInt32();
                    owner.GetCustomDebugInfos(token, gpContext, pdbConstant.CustomDebugInfos);
                    res[w++] = pdbConstant;
                }
            }
            if (res.Length != w)
            {
                Array.Resize(ref res, w);
            }
            return(res);
        }
 public override void GetCustomDebugInfos(MethodDef method, CilBody body, IList <PdbCustomDebugInfo> result) =>
 reader.GetCustomDebugInfos(this, method, body, result);