Beispiel #1
0
        private IMethod Resolve(int index, Context context)
        {
            var         row    = _loader.Metadata.GetRow(TableId.MethodSpec, index);
            SimpleIndex idx    = row[Schema.MethodSpec.Method].Value;
            var         method = _loader.GetMethodDefOrRef(idx, new Context(context, true));

            if (method == null)
            {
                throw new BadTokenException(idx);
            }

            var blob = row[Schema.MethodSpec.Instantiation].Blob;
            var args = ReadMethodSpecArgs(blob, context);

            var spec = GenericType.CreateMethodInstance(method.DeclaringType, method, args);

            //TODO: pass token to GenericType.CreateMethodInstance
            //spec.MetadataToken = SimpleIndex.MakeToken(TableId.MethodSpec, index + 1);

            return(spec);
        }