示例#1
0
        public TypeReferenceCount GetBaseClasses()
        {
            var types = new TypeReferenceCount();
            if (type.BaseType != null)
            {
                types.Add(new Type(type.BaseType, cache));
            }

            return types;
        }
示例#2
0
        public TypeReferenceCount GetBaseTypes()
        {
            var types = new TypeReferenceCount
            {
                GetBaseClasses(),
                GetInterfaces()
            };

            return types;
        }
示例#3
0
        public TypeReferenceCount GetTypeReferences()
        {
            var types = new TypeReferenceCount();

            foreach (var parameter in GetParameters())
            {
                types.Add(parameter);
            }

            types.Add(GetBodyReferences());

            return types;
        }
示例#4
0
        public TypeReferenceCount GetInterfaces()
        {
            var types = new TypeReferenceCount();

            if (type.Interfaces != null)
            {
                foreach (var @interface in type.Interfaces)
                {
                    types.Add(new Type(@interface, cache));
                }
            }

            return types;
        }
示例#5
0
        public TypeReferenceCount GetBodyReferences()
        {
            var types = new TypeReferenceCount();

            if (method.HasBody && method.Body != null)
            {
                foreach (var variable in GetMethodBodyVariables(method))
                {
                    types.Add(variable);
                }

                foreach (var instruction in method.Body.Instructions)
                {
                    var operand = instruction.Operand;
                    if (operand != null)
                    {
                        var operandProcessors = new IOperandType[]
                        {
                            new MemberReferenceType(operand),
                            new ParameterDefinitionType(operand),
                            new VariableDefinitionType(operand),
                            new PrimitiveType(operand), 
                        };

                        foreach (var operandProcessor in operandProcessors)
                        {
                            var type = operandProcessor.GetOperandType();
                            if (type != null)
                            {
                                types.Add(type);
                                break;
                            }
                        }
                    }
                }
            }

            return types;
        }