Пример #1
0
        private void ImplementType(TypeReference tref)
        {
            if (tref is TypeDefinition)
            {
                return;
            }
            if (tref is GenericInstanceType)
            {
                GenericInstanceType gt = (GenericInstanceType)tref;
                for (int i = 0; i < gt.GenericArguments.Count; i++)
                {
                    ImportType(gt.GenericArguments[i]);
                }
                if (gt.ElementType is TypeDefinition)
                {
                    return;
                }
            }
            ImportedType it = ImportType(tref);

            if (it != null)
            {
                if (it.implementedByType)
                {
                    return;                       // already done
                }
                it.implementedByType          = true;
                it.implementedByTypeSpecified = true;
                it.implemented = new List <ImplementedMember>();
                TypeDefinition type = tref.Resolve();
                foreach (var el in type.Methods) // at this point we have to presume the current class implements them all
                {
                    ImplementedMember im = new ImplementedMember();
                    im.name      = el.Name;
                    im.signature = el.FullName;
                    it.implemented.Add(im);
                }
            }
        }
Пример #2
0
        private void ImplementType(TypeReference tref)
        {
            if (tref is TypeDefinition) return;
            if (tref is GenericInstanceType)
            {
                GenericInstanceType gt = (GenericInstanceType)tref;
                for (int i = 0; i < gt.GenericArguments.Count; i++)
                    ImportType(gt.GenericArguments[i]);
                if (gt.ElementType is TypeDefinition) return;

            }
            ImportedType it = ImportType(tref);
            if (it != null)
            {
                if (it.implementedByType) return; // already done
                it.implementedByType = true;
                it.implementedByTypeSpecified = true;
                it.implemented = new List<ImplementedMember>();
                TypeDefinition type = tref.Resolve();
                foreach (var el in type.Methods) // at this point we have to presume the current class implements them all
                {
                    ImplementedMember im = new ImplementedMember();
                    im.name = el.Name;
                    im.signature = el.FullName;
                    it.implemented.Add(im);
                }
            }
        }